-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to filter with a regex pattern with the addition of whitelist pattern option to Yaml Lint task #528
Conversation
src/Task/YamlLint.php
Outdated
$files = $context->getFiles()->name('/\.(yaml|yml)$/i'); | ||
/** @var array $config */ | ||
$config = $this->getConfiguration(); | ||
$whitelistPatterns = isset($config['whitelist_patterns']) ? $config['whitelist_patterns'] : []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$whitelistPatterns = $config['whitelist_patterns'];
isset check is done in getConfigurableOptions()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for the reply.
I've deleted the isset check on $whitelistPatterns
src/Task/YamlLint.php
Outdated
/** @var array $config */ | ||
$config = $this->getConfiguration(); | ||
$whitelistPatterns = isset($config['whitelist_patterns']) ? $config['whitelist_patterns'] : []; | ||
$extensionPattern = '/\.(yaml|yml)$/i'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In most tasks, this variable is named $extensions
(for consistency)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable name has been changed : $extensionPattern -> $extensions
…name variable for the code consistency
Hi, Requested changes have been done. Could you check the pull request again ? Thanks 😃 |
Hi @DidYoun, Thanks for the PR! The changes look good. |
As for PRs :
This PR add a new whitelist_patternsoption to Yamllint task. It will be used to filter files to be validated.
Example for a Symfony, validate PHP files only in src/ directory
New Task Checklist:
run()
method readable?run()
method using the configuration correctly?