Enforcing WordPress Coding Standards
CAWeb utilizes WPCS to enforce WordPress Coding Standards. Make sure composer is installed along with necessary packages, from a terminal in the projects root directory run the commands below.
composer --version
composer install --no-dev
.\vendor\bin\phpcs --version
.\vendor\bin\php-cs-fixer --version
.\vendor\bin\phpcbf --version
To run the PHP_CodeSniffer for WordPress Coding Violations
To run the PHP Code Beautifier and Fixer
To run the PHP CS Fixer
Note: The following flag can be added when running the PHP_CodeSniffer.
--report-file=<file location>- Outputs the results to a file.
.\vendor\bin\phpcs <file_name>- Checks a specific file.
.\vendor\bin\phpcs *.php- Checks all PHP files.
.\vendor\bin\phpcs <directory_name>- Checks all files in a given directory.
.\vendor\bin\phpcbf <file_name>- Checks a specific file.
.\vendor\bin\phpcbf <directory_name>- Checks all files in a given directory.
Note: When using this tool please load the config file found in .circleci/caweb.php_cs
--config=.circleci/caweb.php_csLoad CAWeb Theme PHP CS Fixer config file.
.\vendor\bin\php-cs-fixer <file_name>- Checks a specific file.
.\vendor\bin\php-cs-fixer <directory_name>- Checks all files in a given directory.