Skip to content

Separate phpcs.xml.dist Files for Each Plugin to Isolate Text Domains#1002

Merged
westonruter merged 11 commits into
feature/modules-to-pluginsfrom
fix/997-separate-phpcs
Feb 27, 2024
Merged

Separate phpcs.xml.dist Files for Each Plugin to Isolate Text Domains#1002
westonruter merged 11 commits into
feature/modules-to-pluginsfrom
fix/997-separate-phpcs

Conversation

@mukeshpanchal27

@mukeshpanchal27 mukeshpanchal27 commented Feb 21, 2024

Copy link
Copy Markdown
Member

Summary

Fixes #997

Checklist

  • PR has either [Focus] or Infrastructure label.
  • PR has a [Type] label.
  • PR has a milestone or the no milestone label.

@mukeshpanchal27 mukeshpanchal27 added [Type] Enhancement A suggestion for improvement of an existing feature Infrastructure Issues for the overall performance plugin infrastructure no milestone PRs that do not have a defined milestone for release Creating standalone plugins labels Feb 21, 2024
@mukeshpanchal27 mukeshpanchal27 self-assigned this Feb 21, 2024
Comment thread composer.json
Comment thread phpcs.ruleset.xml
Comment thread plugins/auto-sizes/.gitattributes Outdated
Comment thread plugins/auto-sizes/.gitignore Outdated
@thelovekesh

Copy link
Copy Markdown
Member

Tests the PHPCS config with the following commands by changing the text domains, and it's working as expected:

Commands output
➜  performance git:(fix/997-separate-phpcs) ✗ build-cs/vendor/bin/phpcs                                             
......E..................................................... 60 / 69 (87%)
.........                                                    69 / 69 (100%)



FILE: /home/thelovekesh/Desktop/loki/wordpressdev/public/content/plugins/performance/modules/database/audit-autoloaded-options/can-load.php
--------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------------------------
 15 | ERROR | Mismatched text domain. Expected 'performance-lab' or 'default' but got 'performance'. (WordPress.WP.I18n.TextDomainMismatch)
--------------------------------------------------------------------------------------------------------------------------------------------

Time: 2.3 secs; Memory: 36MB

➜  performance git:(fix/997-separate-phpcs) ✗ build-cs/vendor/bin/phpcs plugins/auto-sizes --standard=plugins/auto-sizes/phpcs.xml.dist
.E 2 / 2 (100%)



FILE: /home/thelovekesh/Desktop/loki/wordpressdev/public/content/plugins/performance/plugins/auto-sizes/hooks.php
---------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------------
 29 | ERROR | Mismatched text domain. Expected 'auto-sizes' or 'default' but got 'auto-'. (WordPress.WP.I18n.TextDomainMismatch)
---------------------------------------------------------------------------------------------------------------------------------

Time: 85ms; Memory: 16MB

@swissspidy

Copy link
Copy Markdown
Member

Btw I am looking into those PHP unit test failures, probably has to do with yesterday's MariaDB update.

Comment thread phpcs.xml.dist
Comment thread plugins/auto-sizes/phpcs.xml.dist Outdated
Comment thread phpcs.xml.dist
Comment thread plugins/auto-sizes/phpcs.xml.dist Outdated

@joemcgill joemcgill left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I like where this is headed, though I think we will need to update the various ways that we run PHPCS via local scripts to make sure we're running the correct ruleset for each plugin. I left a suggestion, but I'm not totally sold that this is the most maintainable approach.

Comment thread phpcs.ruleset.xml Outdated
Comment thread phpcs.xml.dist Outdated
Comment thread plugins/auto-sizes/phpcs.xml.dist Outdated
Comment thread composer.json
Comment thread phpcs.xml.dist Outdated
@mukeshpanchal27 mukeshpanchal27 marked this pull request as ready for review February 26, 2024 04:57
@github-actions

github-actions Bot commented Feb 26, 2024

Copy link
Copy Markdown

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: mukeshpanchal27 <[email protected]>
Co-authored-by: felixarntz <[email protected]>
Co-authored-by: thelovekesh <[email protected]>
Co-authored-by: swissspidy <[email protected]>
Co-authored-by: westonruter <[email protected]>
Co-authored-by: joemcgill <[email protected]>

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

Comment thread phpcs.xml.dist Outdated

@felixarntz felixarntz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@mukeshpanchal27 This looks great to me overall. A few small points of feedback.

Comment thread phpcs.xml.dist Outdated
Comment thread phpcs.xml.dist Outdated
Comment thread .gitattributes
@mukeshpanchal27

Copy link
Copy Markdown
Member Author

@felixarntz @joemcgill I have addressed the feedback in the PR. It's ready for merge now. Could you please review it when you have a moment?

@felixarntz felixarntz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @mukeshpanchal27, LGTM!


<rule ref="../../phpcs.ruleset.xml"/>

<config name="text_domain" value="auto-sizes"/>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Related to my previous feedback, we could add default as an allowed text domain for all plugins, but definitely not required as long as we don't use any core strings in them.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we should keep this omitted unless we require core strings.

@felixarntz

Copy link
Copy Markdown
Member

@joemcgill Can you please take another look at this as you previously requested changes?

@joemcgill joemcgill left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the updates. I think this looks good now.

@westonruter westonruter merged commit 3b40aa4 into feature/modules-to-plugins Feb 27, 2024
@westonruter westonruter deleted the fix/997-separate-phpcs branch February 27, 2024 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Infrastructure Issues for the overall performance plugin infrastructure no milestone PRs that do not have a defined milestone for release [Type] Enhancement A suggestion for improvement of an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants