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 proposal to remove the WordPress-Docs ruleset #56982

Merged
merged 1 commit into from
Dec 13, 2023

Conversation

anton-vlasenko
Copy link
Contributor

@anton-vlasenko anton-vlasenko commented Dec 12, 2023

What?

This pull request removes the WordPress-Docs ruleset from Gutenberg with the goal of simplifying the backporting process.

Fixes #56487.

Why?

  1. Simplifies the backporting process from Core to Gutenberg.
  2. Reduces contributor workload.

Also, please read the proposal as it explains this in more detail.

How?

  1. Removes the WordPress-Docs ruleset from the phpcs.xml.dist file.
  2. Removes Squiz.Commenting* and Generic.Commenting.DocComment* rules as they are added by the WordPress-Docs ruleset and are no longer needed.
  3. Reverts changes made in commit e1a88b3 in the part that concerns the phpcs.xml.dist file (those changes are no longer needed).

Testing Instructions

Review the changes and make sure that the Github CI jobs pass.

Testing Instructions for Keyboard

Screenshots or Screencast

Copy link

github-actions bot commented Dec 12, 2023

This pull request changed or added PHP files in previous commits, but none have been detected in the latest commit.

Thank you! ❤️

Copy link

github-actions bot commented Dec 12, 2023

Flaky tests detected in cbfc228.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7199385494
📝 Reported issues:

@anton-vlasenko anton-vlasenko marked this pull request as ready for review December 13, 2023 14:27
@anton-vlasenko anton-vlasenko added the [Type] Code Quality Issues or PRs that relate to code quality label Dec 13, 2023
@hellofromtonya hellofromtonya added the Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts label Dec 13, 2023
@@ -1651,7 +1651,7 @@ private function apply_attributes_updates( $shift_this_point = 0 ) {
* replacements adjust offsets in the input document.
*/
foreach ( $this->bookmarks as $bookmark_name => $bookmark ) {
$bookmark_end = $bookmark->start + $bookmark->length;
$bookmark_end = $bookmark->start + $bookmark->length;
Copy link
Contributor

Choose a reason for hiding this comment

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

This change is out-of-scope for this PR. Need to do it in a separate issue/PR please.

Copy link
Contributor Author

@anton-vlasenko anton-vlasenko Dec 13, 2023

Choose a reason for hiding this comment

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

Thank you for the review!
I would say it's related to some degree because the following exclude pattern was added to phpcs.xml.dist to prevent these files from being checked against the WordPress-Docs ruleset:

<exclude-pattern>./lib/compat/wordpress-*/html-api/*.php</exclude-pattern>

If WordPress-Docs is disabled, the <exclude-pattern> statement above is no longer needed.
However, I don't mind submitting another pull request to address that specific issue. I will revert this now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in ae3f74476b4ce9bddcc82d9e2572826650624e4d.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see this out of scope because the alignment of = in the source code is not part of the WordPress-Docs ruleset.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest making a PR for that alignment issue and then once merged into trunk, then rebase this PR to include that change.

Copy link
Member

Choose a reason for hiding this comment

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

was there a plan to add the rule back in that was removed for the html api? this caused another hassle with @SergeyBiryukov's change that started blocking backports into Gutenberg.

was it even intentional that the HTML API exclusion was removed?

b592ba9#diff-05ae9cddcaec1e845771a7db224961439f83ef5939ec67d3a48744cb34d7e58bL62-L63

should we add that exclusion back in?

Copy link
Contributor Author

@anton-vlasenko anton-vlasenko Dec 21, 2023

Choose a reason for hiding this comment

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

was it even intentional that the HTML API exclusion was removed?

@dmsnell
Yes, it was 100% intentional.
Personally, I'd only add exceptions for conflicting rules (i.e. the ones that aren't enabled in Core but are enabled in Gutenberg), like VariableAnalysis.CodeAnalysis.VariableAnalysis.

should we add that exclusion back in?

If it makes things easier, please add it back.

Copy link
Member

Choose a reason for hiding this comment

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

thanks. I'll do that and add you as a reviewer. given how frequently it seems that the rules change, and how people rush through changes without review that end up introducing challenges I'd rather we treat the HTML API compatibility layer just like we treat NPM packages, which is why we added this exclusion originally.

thanks for your guidance on this.

is there anything we can do to alert someone not to remove the rule again? I originally thought that its very nature of existing as an exclusion would prevent it, but would a large "DO NOT REMOVE" warning help? I prefer to avoid those if possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for your guidance on this.

You are welcome.

is there anything we can do to alert someone not to remove the rule again? I originally thought that its very nature of existing as an exclusion would prevent it, but would a large "DO NOT REMOVE" warning help

Perhaps the comment should explain why this exclusion was made so that people who don't know the context wouldn't remove it. Something along the lines of, Do not remove this exclusion, as it is made for compatibility reasons; Gutenberg and Core PHPCS standards are not fully aligned at the moment.

What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

thanks. I'll try and be more obtuse in the language. When this was originally removed in b592ba99 it read…

<!-- Exclude files maintained in WordPress Core and backported to Gutenberg -->

I've updated it in #57922 to read…

<!-- Exclude files maintained in WordPress Core and backported to Gutenberg
	     DO NOT REMOVE these rules; these files are "built" artifacts from Core
	     and when they are removed it prevents keeping the repos in sync. -->

Hoping this does a better job.

@anton-vlasenko anton-vlasenko force-pushed the try/remove-wordpress-docs-coding-standard branch from aeb0207 to 9094632 Compare December 13, 2023 18:06
@anton-vlasenko anton-vlasenko force-pushed the try/remove-wordpress-docs-coding-standard branch from 9094632 to cbfc228 Compare December 13, 2023 18:16
Copy link
Contributor

@hellofromtonya hellofromtonya left a comment

Choose a reason for hiding this comment

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

LGTM 👍 Thanks @anton-vlasenko!

Copy link
Member

@aaronjorbin aaronjorbin left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks @anton-vlasenko!

@anton-vlasenko anton-vlasenko merged commit b592ba9 into trunk Dec 13, 2023
51 checks passed
@anton-vlasenko anton-vlasenko deleted the try/remove-wordpress-docs-coding-standard branch December 13, 2023 19:08
@github-actions github-actions bot added this to the Gutenberg 17.4 milestone Dec 13, 2023
artemiomorales pushed a commit that referenced this pull request Jan 4, 2024
…#56982)

Remove the WordPress-Docs coding standard and associated changes. Refer to #56487 for more details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal to align Gutenberg coding standards with Core by temporarily disabling the WordPress-Docs ruleset
4 participants