WordPress.org

Make WordPress Core

Opened 11 days ago

Last modified 10 days ago

#47853 assigned enhancement

Minor update to composer lint scripts

Reported by: dingo_d Owned by: pento
Milestone: 5.3 Priority: normal
Severity: normal Version: trunk
Component: Build/Test Tools Keywords: has-patch
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 (2)

47853.diff (772 bytes) - added by dingo_d 11 days ago.
Update composer.json
47853.2.diff (806 bytes) - added by dingo_d 10 days ago.
Fix the review comments

Download all attachments as: .zip

Change History (6)

@dingo_d
11 days ago

Update composer.json

#1 @jrf
11 days ago

@dingo_d Bit of feedback:

  1. @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
  2. --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).

#2 @SergeyBiryukov
10 days ago

  • Component changed from General to Build/Test Tools

#3 @netweb
10 days ago

  • Keywords needs-refresh added
  • Milestone changed from Awaiting Review to 5.3

@dingo_d
10 days ago

Fix the review comments

#4 @dingo_d
10 days ago

  • Keywords needs-refresh removed

Thanks for the review :) I've fixed the issues and added a new patch.

Note: See TracTickets for help on using tickets.