-
Notifications
You must be signed in to change notification settings - Fork 54
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
Add valid checks slug array and warning for non-existent checks #470
base: trunk
Are you sure you want to change the base?
Conversation
A function return_valid_check_slugs() has been added to the file Abstract_Check_Runner.php to filter out any non-existent checks from the $check_slugs array. It also echos a warning if a slug from the passed array does not exist. This enhancement is reflected in the WP CLI --checks argument as noted in the readme documentation.
IMO that‘s the wrong approach to add such validation. This claas shouldn‘t arbitrarily output stuff using echo. |
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
@alewolf Could you resolve the conflicts? |
@davidperezgar I would, if the tests would show whats wrong. |
Resolve the conflicts and it will run the tests again. |
@davidperezgar What conflicts? Speficics please. |
@davidperezgar Ok. Conflicts have been resolved. |
|
||
foreach ( $check_slugs as $slug ) { | ||
if ( ! in_array( $slug, $available_checks_slugs, true ) ) { | ||
echo 'Warning: Check with the slug "' . $slug . '" does not exist.' . PHP_EOL; |
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.
Make translatable the sentence and escape the slug.
A function return_valid_check_slugs() has been added to the file Abstract_Check_Runner.php to filter out any non-existent checks from the $check_slugs array. It also echos a warning if a slug from the passed array does not exist. This enhancement is reflected in the WP CLI --checks argument as noted in the readme documentation.
This is for the issue #348