-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Refine include/exclude patterns in phpcs.xml.dist #59712
Conversation
1abba1a
to
cd91a11
Compare
Make regexp patterns more distinrns with /. 1. Don't use . before / in exclude/include pattern as it doesn't change anything. 2. Prepend exclude/include patterns with /.
2a51c44
to
61d2a6f
Compare
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. |
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.
LGTM! Thank you for this cleanup/refinement 🧹
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.
This matched the approach we use in core too which is good.
Thank you for the review and approval, @ironprogrammer and @scruffian! |
…ordPress#59712) 1. removed unnecessary dots at the start of include/exclude patterns; 2. added leading slashes to patterns to ensure they match the intended paths without accidentally including unintended ones; 3. escaped dots as `\.` to match literal dots in file paths, enhancing the precision of the patterns, as advised by PHP_CodeSniffer's [documentation](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#ignoring-files-and-folders); 4. added `$` to the end of patterns targeting `.php` files to ensure they match only at the end of file paths. Co-authored-by: anton-vlasenko <[email protected]> Co-authored-by: ironprogrammer <[email protected]> Co-authored-by: scruffian <[email protected]> Co-authored-by: azaozz <[email protected]>
What?
This PR refines patterns used in
<exclude-pattern>
and<include-pattern>
statements.Why?
According to the documentation on ignoring files and folders, the patterns in include/exclude statements are essentially regular expressions.
Therefore, beginning a pattern with a
.
(dot) is redundant since.
doesn't match the root folder.How?
\.
to match literal dots in file paths, enhancing the precision of the patterns, as advised by PHP_CodeSniffer's documentation;$
to the end of patterns targeting.php
files to ensure they match only at the end of file paths.Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast