#47853 closed enhancement (fixed)
Minor update to composer lint scripts
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 5.3 | Priority: | normal |
Severity: | normal | Version: | 5.3 |
Component: | Build/Test Tools | Keywords: | has-patch has-dev-note |
Focuses: | coding-standards | Cc: |
Description
I've modified the composer scripts used for checking the standards of the core.
I've added @php
prefix, which will make sure that the scripts are run against the same PHP version as with which Composer is called.
I've also changed the location from where the scripts are called, since it's assumed that the user will install the packages using Composer (this is the ./vendor/bin/phpcs
and ./vendor/bin/phpcbf
part).
Also the last script was just repeating the lint
one so I've just used that.
I don't think that the code sniffer is used without composer so this should be ok.
Tested it locally and got the same result.
Attachments (3)
Change History (11)
#1
@
6 years ago
@dingo_d Bit of feedback:
@php ./vendor/bin/phpcs
and the likes won't work on Windows. You need to reference the actual PHP file, not the bash script for it to work cross-platform, i.e.@php ./vendor/squizlabs/php_codesniffer/bin/phpcs
. See: https://github.com/composer/composer/issues/7645--report-summary --report-source
can be shortened to--report=summary,source
(PHPCS 3.x feature)
Regarding removing --standard=phpcs.xml.dist
👍👍
PHPCS will automatically pick up on a phpcs.xml.dist
file when it's available and not hard-coding it allows for devs to use the scripts and still overrule the config with a local phpcs.xml
file containing extra rules (like PHPCompatibilityWP for instance).
#4
@
6 years ago
- Keywords needs-refresh removed
Thanks for the review :) I've fixed the issues and added a new patch.
#6
@
6 years ago
- Keywords commit added
Thanks @dingo_d! 47853.3.diff is just a refresh of 47853.2.diff because I could not get that to apply cleanly. Using @php
came up on another ticket that will add a new command.
#8
@
6 years ago
- Keywords has-dev-note added; commit removed
Mentioned in the Miscellaneous Developer Focused Changes dev note for 5.3: https://make.wordpress.org/core/2019/10/15/miscellaneous-developer-focused-changes-in-5-3/
Update composer.json