run
$ composer update
$ composer phpcs-configset
$ composer run-phpcs:theme (for themes) or run-phpcs:plugin (for plugins)
Last active
March 21, 2018 06:26
-
-
Save alokstha1/ac084939274cab0ab4a49e65e46da1a5 to your computer and use it in GitHub Desktop.
WPCS with php composer for WordPress themes and plugins in your project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"repositories": [{ | |
"type" : "package", | |
"package" : { | |
"name" : "wpcs", | |
"version" : "0.11.0", | |
"type" : "wpcs", | |
"source" : { | |
"url" : "[email protected]:WordPress-Coding-Standards/WordPress-Coding-Standards.git", | |
"type" : "git", | |
"reference" : "master" | |
} | |
} | |
}], | |
"require": { | |
"wpcs":"*", | |
"squizlabs/php_codesniffer": "2.9" | |
}, | |
"extra": { | |
"installer-paths": { | |
"{$name}/" : ["type:wpcs"] | |
} | |
}, | |
"scripts" : { | |
"post-install-cmd": [ | |
"@phpcs-configset" | |
], | |
"post-update-cmd": [ | |
"@phpcs-configset" | |
], | |
"phpcs-configset" : [ | |
"\"vendor/bin/phpcs\" --config-set installed_paths vendor/wpcs" | |
], | |
"run-phpcs": [ | |
"@run-phpcs:stack", | |
"@run-phpcs:theme" | |
], | |
"run-phpcs:stack": [ | |
"\"vendor/bin/phpcs\" --standard=WordPress-Core --exclude=WordPress.Files.FileName --extensions=php -p -n -s --colors ." | |
], | |
"run-phpcs:theme": [ | |
"\"vendor/bin/phpcs\" --standard=WordPress-Core --exclude=WordPress.Files.FileName --extensions=php -p -n -s --colors ./wp-content/themes/" | |
], | |
"run-phpcs:plugin": [ | |
"\"vendor/bin/phpcs\" --standard=WordPress-Core --exclude=WordPress.Files.FileName --extensions=php -p -n -s --colors ./wp-content/plugins/" | |
], | |
"fix-phpcs": [ | |
"@fix-phpcs:stack", | |
"@fix-phpcs:theme" | |
], | |
"fix-phpcs:stack": [ | |
"\"vendor/bin/phpcbf\" --standard=WordPress-Core --extensions=php -n ." | |
], | |
"fix-phpcs:theme": [ | |
"\"vendor/bin/phpcbf\" --standard=WordPress-Core --extensions=php -n ./wp-content/themes/" | |
], | |
"fix-phpcs:plugin": [ | |
"\"vendor/bin/phpcbf\" --standard=WordPress-Core --extensions=php -n ./wp-content/plugins/" | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment