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

Show check name in results #380

Closed
wants to merge 3 commits into from
Closed

Conversation

ernilambar
Copy link
Member

@ernilambar ernilambar commented Jan 9, 2024

Related to #329

wp plugin check pc-sample --fields=line,column,type,code,message,check

Sample output:

Screenshot 2024-01-09 at 5 18 46 PM

@ernilambar ernilambar force-pushed the trait-check branch 3 times, most recently from 00905ca to 728aff3 Compare January 9, 2024 11:26
@ernilambar ernilambar marked this pull request as ready for review January 9, 2024 11:29
@ernilambar
Copy link
Member Author

Looks like PHPUnit tests also need to be adjusted with new check value. I will update those after review.

@ernilambar ernilambar force-pushed the trait-check branch 2 times, most recently from d7603c2 to 80b51db Compare January 11, 2024 06:50
@ernilambar
Copy link
Member Author

@swissspidy
Copy link
Member

This is an alternative to #376, correct?

@ernilambar
Copy link
Member Author

This is an alternative to #376, correct?

Yes.

Copy link
Member

@mukeshpanchal27 mukeshpanchal27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ernilambar for the PR! Left some feedback and questions for consideration.

includes/Traits/Check_Name.php Outdated Show resolved Hide resolved
includes/Traits/Check_Name.php Outdated Show resolved Hide resolved
includes/Traits/Check_Name.php Outdated Show resolved Hide resolved
includes/Traits/Amend_Check_Result.php Outdated Show resolved Hide resolved
includes/Traits/Check_Name.php Outdated Show resolved Hide resolved
@ernilambar ernilambar changed the title Add trait for check name Show check name in results Jan 16, 2024
@ernilambar
Copy link
Member Author

PR updated.

@swissspidy
Copy link
Member

swissspidy commented Jan 16, 2024

If we display the check name/slug in the results like this, we need to be certain it‘s correct and matches the slug used in Default_Check_Repository. This way users can easily exclude the check next time around.

But what if someone uses the wp_plugin_check_checks filter to add their custom check where this might not be the case (i.e class name differe heavily from the array key)?

IMHO the current solution is not robust enough for this case.

@ernilambar
Copy link
Member Author

ernilambar commented Jan 16, 2024

What if validate slug and class name in function register_check( $slug, Check $check ). If the slug and class name does not follow the standard, exception is thrown right away while registering.

Another alternative:
In the filter wp_plugin_check_checks rather than accepting slug=>Class_Name, we accept class name only. And our code will generate slug accordingly. This way there will be no mismatched slug and class name.

@ernilambar
Copy link
Member Author

Closing. We need to explore more robust approach.

@ernilambar ernilambar closed this Jul 15, 2024
@ernilambar ernilambar deleted the trait-check branch July 15, 2024 12:17
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