Skip to content
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

Open
wants to merge 6 commits into
base: trunk
Choose a base branch
from

Conversation

alewolf
Copy link

@alewolf alewolf commented Jun 13, 2024

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

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.
@swissspidy
Copy link
Member

IMO that‘s the wrong approach to add such validation. This claas shouldn‘t arbitrarily output stuff using echo.

Copy link

github-actions bot commented Sep 12, 2024

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: alewolf <[email protected]>
Co-authored-by: swissspidy <[email protected]>
Co-authored-by: davidperezgar <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@davidperezgar
Copy link
Member

@alewolf Could you resolve the conflicts?

@alewolf
Copy link
Author

alewolf commented Sep 26, 2024

@davidperezgar I would, if the tests would show whats wrong.

@davidperezgar
Copy link
Member

Resolve the conflicts and it will run the tests again.

@alewolf
Copy link
Author

alewolf commented Sep 27, 2024

@davidperezgar What conflicts? Speficics please.

@davidperezgar
Copy link
Member

Here:
Captura de pantalla 2024-09-27 a las 16 23 15

The merge commit.

@alewolf
Copy link
Author

alewolf commented Oct 1, 2024

@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;
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants