Skip to content

Commit

Permalink
Build/Test Tools: Move Composer script command line directives to the…
Browse files Browse the repository at this point in the history
… PHPCS ruleset.

Also, move all arguments up to the top of the custom ruleset to make it easier to understand the conditions the ruleset is run under.

Props desrosj, jrf.
See #46152.

git-svn-id: https://develop.svn.wordpress.org/trunk@46291 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
desrosj committed Sep 25, 2019
1 parent 3369608 commit 2dbc7e0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
}, },
"scripts": { "scripts": {
"compat": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --standard=phpcompat.xml.dist --report=summary,source", "compat": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --standard=phpcompat.xml.dist --report=summary,source",
"format": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf --report=summary,source --cache -d memory_limit=256M", "format": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf --report=summary,source",
"lint": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --report=summary,source --cache -d memory_limit=256M", "lint": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --report=summary,source",
"lint:errors": "@lint -n" "lint:errors": "@lint -n"
} }
} }
36 changes: 23 additions & 13 deletions phpcs.xml.dist
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@
<ruleset name="WordPress Coding Standards"> <ruleset name="WordPress Coding Standards">
<description>Apply WordPress Coding Standards to all Core files</description> <description>Apply WordPress Coding Standards to all Core files</description>


<!-- Only scan PHP files. -->
<arg name="extensions" value="php"/>

<!-- Whenever possible, cache the scan results and re-use those for unchanged files on the next scan. -->
<arg name="cache"/>

<!-- Set the memory limit to 256M.
For most standard PHP configurations, this means the memory limit will temporarily be raised.
Ref: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#specifying-phpini-settings
-->
<ini name="memory_limit" value="256M"/>

<!-- Strip the filepaths down to the relevant bit. -->
<arg name="basepath" value="./"/>

<!-- Check up to 20 files simultaneously. -->
<arg name="parallel" value="20"/>

<!-- Show sniff codes in all reports -->
<arg value="ps"/>

<file>.</file>

<rule ref="WordPress-Core"/> <rule ref="WordPress-Core"/>
<rule ref="WordPress.CodeAnalysis.EmptyStatement"/> <rule ref="WordPress.CodeAnalysis.EmptyStatement"/>


Expand Down Expand Up @@ -76,19 +99,6 @@
</properties> </properties>
</rule> </rule>


<arg name="extensions" value="php"/>

<!-- Strip the filepaths down to the relevant bit. -->
<arg name="basepath" value="./"/>

<!-- Check up to 20 files simultaneously. -->
<arg name="parallel" value="20"/>

<!-- Show sniff codes in all reports -->
<arg value="ps"/>

<file>.</file>

<!-- Exclude the build folder in the current directory, as Travis puts the checkout in a build directory. --> <!-- Exclude the build folder in the current directory, as Travis puts the checkout in a build directory. -->
<exclude-pattern type="relative">^build/*</exclude-pattern> <exclude-pattern type="relative">^build/*</exclude-pattern>


Expand Down

0 comments on commit 2dbc7e0

Please sign in to comment.