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

Implement readme parser check in trunk #322

Closed
Tracked by #283
felixarntz opened this issue Nov 10, 2023 · 8 comments · Fixed by #346
Closed
Tracked by #283

Implement readme parser check in trunk #322

felixarntz opened this issue Nov 10, 2023 · 8 comments · Fixed by #346
Labels
[Type] Enhancement A suggestion for improvement of an existing feature
Milestone

Comments

@felixarntz
Copy link
Member

The legacy-plugin branch has checks that rely on afragen/wordpress-plugin-readme-parser to actually parse the plugin readme, a feature that is currently missing from the trunk branch for the new plugin version.

We should refactor (and by that enhance) our Plugin_Readme_Check to rely on the WordPressdotorg\Plugin_Directory\Readme\Parser class:

  • We can instantiate the class simply for the first file in the $readme array, since that array will only have 0 or 1 entries anyway.
  • Then we can update the three private methods to accept the instance of the Parser and the single file path, and refactor the logic to use the class instead of manually parsing the file contents.
  • Additionally, we can include a new private method check_for_warnings, to ensure we catch other warnings the parser has encountered. While doing that, let's already implement the code from Create a way to remove certain readme warnings, contributors_ignored. #276 in that new method, to address that problem.
@felixarntz felixarntz added the [Type] Enhancement A suggestion for improvement of an existing feature label Nov 10, 2023
@felixarntz felixarntz added this to the 1.0.0 milestone Nov 10, 2023
@swissspidy
Copy link
Member

Related:

That command also uses the Parser class and reports everything reported by the parser.

@felixarntz
Copy link
Member Author

Thanks for flagging @swissspidy! I think we could potentially combine the two issues, but maybe yours also would encompass things that go beyond this issue (as this issue is focused only on achieving parity with the legacy-plugin branch).

I looked at your related WP-CLI command and have two questions:

@swissspidy
Copy link
Member

swissspidy commented Nov 13, 2023

Both use a copy of the parser class from Meta SVN, so it's the same thing. I think my copy is now just a little outdated as I haven't touched that code in a while. For example it's missing the sanitize_contributors() method (which does not work outside of dotorg anyway).

That is correct, yes.

@mukeshpanchal27 mukeshpanchal27 self-assigned this Nov 27, 2023
@mukeshpanchal27
Copy link
Member

Quick question: Which parser do we needs to use? legacy-plugin or @swissspidy's validate-readme-command?

@swissspidy
Copy link
Member

For the parser itself, we can use afragen/wordpress-plugin-readme-parser which is more up to date. Both are the same, but this one is simply more up to date.

For reporting errors based on the parser results, we can look at validate-readme-command for inspiration for sure.

@afragen
Copy link
Member

afragen commented Dec 18, 2023

FWIW it's my intention to keep the readme-parser updated. I've made it simple to do this. I only need to be aware of when updates occur or run command in the repository at regular intervals.

@afragen
Copy link
Member

afragen commented Dec 18, 2023

If interested you can take a look at the class I use to interact with the readme-parser here, https://github.com/afragen/git-updater/blob/develop/src/Git_Updater/Readme_Parser.php

@ernilambar
Copy link
Member

I am working on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Enhancement A suggestion for improvement of an existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants