Add valid checks slug array and warning for non-existent checks#470
Add valid checks slug array and warning for non-existent checks#470alewolf wants to merge 6 commits intoWordPress:trunkfrom
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.
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