Separate phpcs.xml.dist Files for Each Plugin to Isolate Text Domains#1002
Conversation
|
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 |
|
Btw I am looking into those PHP unit test failures, probably has to do with yesterday's MariaDB update. |
joemcgill
left a comment
There was a problem hiding this comment.
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.
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
felixarntz
left a comment
There was a problem hiding this comment.
@mukeshpanchal27 This looks great to me overall. A few small points of feedback.
|
@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
left a comment
There was a problem hiding this comment.
Thanks @mukeshpanchal27, LGTM!
|
|
||
| <rule ref="../../phpcs.ruleset.xml"/> | ||
|
|
||
| <config name="text_domain" value="auto-sizes"/> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I think we should keep this omitted unless we require core strings.
|
@joemcgill Can you please take another look at this as you previously requested changes? |
joemcgill
left a comment
There was a problem hiding this comment.
Thanks for the updates. I think this looks good now.
Summary
Fixes #997
Checklist
[Focus]orInfrastructurelabel.[Type]label.no milestonelabel.