This composer package will provide some basic code quality checks before committing code by using https://github.com/phpro/grumphp. Check out this Lullabot article for more details.
This has been customised from vijaycs85/drupal-quality-checker for Innoraft needs.
- Add
innoraft/drupal-quality-checker
tocomposer.json
or justcomposer require --dev innoraft/drupal-quality-checker
- Replace
grumphp.yml
in project's root directory (not Drupal root directory) withvendor/innoraft/drupal-quality-checker/grumphp.yml.dist
That's it. Now, all tasks (listed below) run on every git commit
.
Note: As part of install, GrumPHP adds
pre-commit
hook to repository. Existingpre-commit
might get destroyed when install/uninstall.
- PHPCS with Drupal standard.
- PHP Lint
- YAML Lint
- Composer
- Composer Normalize
- JSONLint
- PHP Copy/Paste Detector (CPD)
Long list of additional checks/validators available here.
- Go to custom theme folder and add eslint package with npm
npm install eslint --save-dev
npm install eslint-config-airbnb --save-dev
- Now run this command at project's root directory
cp vendor/innoraft/drupal-quality-checker/eslintrc.json.dist .eslintrc.json
- Update bin key for eslint task under grumphp.yml file with relative address to eslint's bin file.
- Go to custom theme folder and add stylelint package with npm
npm install stylelint --save-dev
- Now run this command at project's root directory
cp vendor/innoraft/drupal-quality-checker/stylelintrc.json.dist .stylelintrc.json
- Update bin key for eslint task under grumphp.yml file with relative address to eslint's bin file.