You can configure the Drupal conding standing by following the below steps:
Step 1:
- Create the drupal directory
- Set its ownership
- Clone the coder repo
sudo mkdir -p /drupal
sudo chown $USER /drupal
cd /drupal
git clone --branch 8.3.x http://git.drupal.org/project/coder.git
cd coder && composer install
Step 2:
- Download the additional packages for analyze deprecated code.
composer require --dev phpstan/phpstan \
phpstan/extension-installer \
mglaman/phpstan-drupal \
phpstan/phpstan-deprecation-rules
Step 3:
- Set the bin path to use the available commands
echo "export PATH=\"$PATH:/drupal/coder/vendor/bin\"" > ~/.profile
Step 4:
- Create the command aliases
# Add below aliases in the bashrc
alias drupalcs="phpcs --standard=Drupal --extensions='php,module,inc,install,test,profile,theme,css,info,txt,md,yml'"
alias drupalcsp="phpcs --standard=DrupalPractice --extensions='php,module,inc,install,test,profile,theme,css,info,txt,md,yml'"
alias drupalcbf="phpcbf --standard=Drupal --extensions='php,module,inc,install,test,profile,theme,css,info,txt,md,yml'"
alias drupalstan="phpstan analyze --memory-limit=-1 --configuration=/drupal/coder/phpstan.neon"
Step 5:
- Execute the below command in terminal
source ~/.bashrc