Difference between revisions of "Setup PHP CodeSniffer"
(→Setup Wordpress Coding Standards (modified by Glma)) |
|||
Line 10: | Line 10: | ||
== Setup Wordpress Coding Standards (modified by Glma) == | == Setup Wordpress Coding Standards (modified by Glma) == | ||
1. Clone our forked copy of Wordpress Coding Standards to a directory named wpcs somewhere in your home directory. | 1. Clone our forked copy of Wordpress Coding Standards to a directory named wpcs somewhere in your home directory. | ||
− | git clone ssh://git@bitbucket.gaslightmedia.com:7999/doc/wordpress-coding-standards.git wpcs | + | git clone <nowiki>ssh://git@bitbucket.gaslightmedia.com:7999/doc/wordpress-coding-standards.git</nowiki> wpcs |
2. Add its path to the PHP_CodeSniffer configuration | 2. Add its path to the PHP_CodeSniffer configuration | ||
phpcs --config-set installed_paths {your path to wpcs}/wpcs | phpcs --config-set installed_paths {your path to wpcs}/wpcs |
Revision as of 09:21, 19 December 2019
Contents
Setup PHP CodeSniffer
Instructions for linux
1. Setup a bin directory in your home folder. 2. Add your bin directory to your PATH variable. 3. Download phpcs and phpcbf files into your bin directory. 4. Rename them to phpcs and phpcbf. 5. Test that they work and files are executable by your user.
Setup Wordpress Coding Standards (modified by Glma)
1. Clone our forked copy of Wordpress Coding Standards to a directory named wpcs somewhere in your home directory.
git clone ssh://git@bitbucket.gaslightmedia.com:7999/doc/wordpress-coding-standards.git wpcs
2. Add its path to the PHP_CodeSniffer configuration
phpcs --config-set installed_paths {your path to wpcs}/wpcs
3. Test phpcs finds it using 'phpcs -i' 4. Set WordPress as the default standard using
phpcs --config-set default_standard WordPress
Visual Studio Code
Install and enable the phpcs extension by Ioannis Kappas (ikappas.phpcs).
In your user settings – CMD+, on Mac or Preferences -> Settings – set these two variables:
{ ... "phpcs.executablePath": "/Users/javorszky/.composer/vendor/bin/phpcs", "phpcs.standard": "WordPress-Extra", ... }
Again, the executablePath should be the result of which phpcs.
Restart VSCode, and you should have code standards enabled.