-
Notifications
You must be signed in to change notification settings - Fork 83
Add Plugin_Check_Command class #72
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
Conversation
|
@felixarntz @jjgrainger The unit tests are not yet completed, but the command's class is a bit large, so that you can review the CLI command code. I will complete the unit test for this soon. Thank you! 🙂 |
felixarntz
left a comment
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.
@vishalkakadiya Left some feedback. Overall this looks solid.
There are a few things that we need to reconsider and discuss outside of this PR, e.g. how to better handle setup of the runner classes. But we can address that in a separate follow up PR later once we have figured out the approach.
jjgrainger
left a comment
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.
Thanks @vishalkakadiya a couple of small changes here but there is 1 part of this work I want to discuss with @felixarntz on next steps too.
joemcgill
left a comment
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.
One suggestion, otherwise this is looking pretty good.
|
@joemcgill I have addressed your feedback on this PR and left one comment. You can review it now, thanks! |
felixarntz
left a comment
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.
@jjgrainger This is almost good to go, there are just a few critical things missing around the runner setup, which we recently prepared for via #95.
mukeshpanchal27
left a comment
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.
Thanks @jjgrainger, I left some minor update feedback, one of which related to the option in the command not working.
| /** | ||
| * Run plugin check. | ||
| * | ||
| * ## OPTIONS |
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.
@jjgrainger Is the options argument working for you? or will it be in an upcoming PR?
npm run wp-env run cli wp plugin check akismet --format=json it give me an error Error: Too many positional arguments: json
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.
Thanks @mukeshpanchal27 I experienced the same issue here but am uncertain what the cause is. I noticed that the docblock comment for the command wasn't correct for these options, however updating these has not resolved the issue. I'll keep looking into this.
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.
Since you're invoking WP-CLI in the container, I think you're missing an extra --. You need to use npm run wp-env run cli -- wp plugin check akismet --format=json
felixarntz
left a comment
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.
@jjgrainger One more thing here, and one nit-pick, but should be quick to address. I'll give this my approval already since the tweaks should be trivial. Excited to see this shape!
| $runner->set_plugin( $plugin ); | ||
| $runner->set_check_slugs( $checks ); |
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.
These calls need to happen unconditionally, even if you're using the runner returned by Plugin_Request_Utility::get_runner. That is the entire reason why we implemented the validation in Abstract_Check_Runner.
| $checks = wp_parse_list( $options['checks'] ); | ||
|
|
||
| // Get the CLI Runner. | ||
| $runner = Plugin_Request_Utility::get_runner(); |
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.
Nit-pick: Not sure if this can realistically ever happen, but we should probably cater for it just in case: If this returns any object that is not a CLI_Runner, we should error out. For example, imagine something goes wrong in the object-cache.php invoked logic and then somehow this returns an AJAX_Runner here. Extremely unlikely, but possible based on the method implementation, so we may want to cater for that.
joemcgill
left a comment
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.
I'm happy with the current iteration once @felixarntz's comments have been addressed.
|
Thanks all, I've updated the PR based on the latest feedback. Will merge this now |
Add Plugin_Check_Command class
Closes #30