Last active
February 13, 2020 13:56
-
-
Save achraf-jeday/4e6d060a7ecfe099aadce7b984f1c688 to your computer and use it in GitHub Desktop.
PHP_CodeSniffer phpcs How to install PHP_CodeSniffer and to check drupal code (.module)
This file contains 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
To install PHP_CodeSniffer and to check drupal code type the following (composer is required system-wide): | |
First make sure you have the composer bin dir in your PATH. The default value is ~/.composer/vendor/bin/, but you can check the value that you need to use by running: | |
composer global config bin-dir --absolute | |
echo $PATH | |
PATH=$PATH:~/.composer/vendor/bin/ | |
echo $PATH | |
Add the following to the /home/<user>/.profile file: | |
export PATH="$PATH:/home/<user>/.composer/vendor/bin" | |
composer global require "squizlabs/php_codesniffer=*" | |
composer global require drupal/coder | |
composer global require dealerdirect/phpcodesniffer-composer-installer | |
phpcs -i | |
Above command should include DrupalPractice and Drupal in the installed coding standards list. | |
phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md --ignore=node_modules,bower_components,vendor /home/achraf/docker/alpha-sierra-docker/web/sites/all/modules/custom/alpha_sierra_main/theme/entity_no_title.tpl.php | |
phpcbf --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md --ignore=node_modules,bower_components,vendor /home/achraf/docker/docker_drupal/web/modules/custom/custom_opm/custom_opm.module |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment