Easily run PHPCS and PHPCBF commands to detect violations of a defined coding standard. Coding standards are included within the Docksal cli
container for both Drupal and WordPress.
fin addon install phpcs
Once installed the following commands can be ran to help with code quality.
The main phpcs
script that tokenizes PHP, JavaScript and CSS files to detect violations of a defined coding standard.
# Default Command
fin phpcs cs "modules/test_module"
# Run With Other Options
fin phpcs cs --standards="ExtraStandards,Drupal,DrupalPractice" modules/test_module
The second phpcbf
script automatically corrects coding standard violations.
# Default Command
fin phpcs cbf "modules/test_module"
# Run With Other Options
fin phpcs cbf --standards="ExtraStandards,Drupal,DrupalPractice" modules/test_module
For Drupal: Drupal,DrupalPractice
For WordPress: WordPress
To customize these the --standards
option could be used.
Additionally the PHPCS_STANDARDS
variable may set within .docksal/docksal.env
.
For Drupal: php,module,inc,install,test,profile,theme,css,info,txt,md
For WordPress: php
To customize these the --extensions
option could be used.
Additionally the PHPCS_EXTENSIONS
variable may set within .docksal/docksal.env
.