[wp-trac] [WordPress Trac] #53837: Move the basepath config out of phpcs.xml.dist
WordPress Trac
noreply at wordpress.org
Fri Jul 30 09:37:44 UTC 2021
#53837: Move the basepath config out of phpcs.xml.dist
------------------------------+-----------------------------
Reporter: johnbillion | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Build/Test Tools | Version:
Severity: normal | Keywords: needs-patch
Focuses: |
------------------------------+-----------------------------
The `basepath` config option in phpcs.xml.dist is there to shorten the
path names in PHPCS reports so they're relative to the project root
directory rather than being absolute.
A few PHPCS tools I've used don't support a change to the base path and
expect absolute paths in the report, and break without one. The most
prominent example is
[https://marketplace.visualstudio.com/items?itemName=ikappas.phpcs the
PHPCS extension for VS Code] which has over a million installations.
Unfortunately this particular extension hasn't seen any updates for three
years, yet remains the number one PHPCS extension.
Clearly this is a problem with the third party tools but I've now seen
several developers trying to contribute to WordPress core using VS Code
and not being able to get PHPCS annotations working in their editor
because the extension is expecting absolute paths in the report but
receiving relative ones.
To solve the immediate problem we can move the `basepath` config out of
`phpcs.xml.dist` and into the `--basepath` flag in the `lint` script in
composer.json. This means external PHPCS tools will get the full paths but
anything that uses `composer lint` gets the relative paths.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53837>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list