This composer package will provide some basic code quality checks before commiting code.
It checks only modified files or new files.
This repository currently has following checks:
This needs to be done only once either while creating a project or enabling code checks in existing project.
composer.json
:{
"minimum-stability": "dev"
}
composer require wunderio/code-quality
Link maintenance script in composer.json
:
{
"scripts": {
"post-install-cmd": [
"./vendor/wunderio/code-quality/install-update.sh"
],
"post-update-cmd": [
"./vendor/wunderio/code-quality/install-update.sh"
]
}
}
composer update
or composer install
When a developer pulls a project containing code-quality:
composer update
or composer install
will bring in new package and ensures git pre-commit hook by executing install-update.sh
.If you need to customize the rules for PHP CodeSniffer then drop in phpcs.xml in the same folder as composer.json.
The pre-commit hook will be automatically run upon executing git commit
.
The code scanning can be avoided by git commit --no-verify
.
Files can be scanned individually: pre-commit myfile.php
.