#49781 closed enhancement (fixed)
PHPCS config: exclude plugins and themes within src
Reported by: | johnbillion | Owned by: | johnbillion |
---|---|---|---|
Milestone: | 5.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | has-patch has-dev-note |
Focuses: | coding-standards | Cc: |
Description
When running the PHPCS linting locally (eg. with composer lint:errors
), there are files that can exist within an installation that's running from src
which should not be linted:
- Plugins
- Must-Use Plugins
- Drop-in plugins
- Themes other than the twenty* themes
These should all be excluded from linting so that a clean lint can be run on an active installation of WordPress running from src
.
Attachments (1)
Change History (10)
#1
@
5 years ago
- Keywords has-patch added; needs-patch removed
- Milestone changed from Awaiting Review to 5.5
#4
@
5 years ago
This is for running a WordPress site from src
using npm run dev
. It's a standard setup.
None of the exclusions are custom for my particular dev environment, they're all files that WordPress core supports and uses.
#5
@
5 years ago
It's worth noting that all the files listed in 49781.diff already exist in .gitignore
for the same reason.
#6
@
5 years ago
- Keywords commit added
Ok, in that case, sounds reasonable. Though it might be helpful to annotate the start and end of the list with a note saying that that list should be kept in sync with the .gitignore
file ?
#7
@
5 years ago
That's a good idea, and reminds me that the svn:ignore
prop for SVN needs to be synced too as it's out of date. I'll open a ticket.
#8
@
5 years ago
- Owner set to johnbillion
- Resolution set to fixed
- Status changed from new to closed
In 47742:
#9
@
4 years ago
- Keywords has-dev-note added; commit removed
Referenced in the following dev note: https://make.wordpress.org/core/2020/07/14/php-related-improvements-changes-wordpress-5-5-edition/.
@johnbillion How do those files get into the
src
directory ?Are there dev environment commands in place which generate those files ? or put them there ?
If not and if it's dev choice to put them there (for testing purposes or otherwise), this could become a never-ending list as different devs use different tools.
In that case, adjusting the WP Core ruleset is not the way to "fix" this.
Instead you should add a
phpcs.xml
file to the project root in your local environment. That file will be automatically ignored for committing, but should be automatically picked up by the PHPCS run.In that file, you'd then have something like the following:
Does that help ?