forked from Space48/magento2-code-quality
-
Notifications
You must be signed in to change notification settings - Fork 0
/
code-quality.mk
26 lines (20 loc) · 1.42 KB
/
code-quality.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
### Code Quality section
# requires var "CQ_STARTING_COMMIT_HASH" set to starting commit hash
# requires var "CQ_STARTING_COMMIT_DATE" set to starting commit date
linters-init: ## init linters on local machine
warden env exec php-fpm chmod +x vendor/space48/magento2-code-quality/script/install.sh
warden env exec php-fpm ./vendor/space48/magento2-code-quality/script/install.sh
warden env exec php-fpm /bin/bash -c '[ -d .git ] || mkdir .git'
chmod +x vendor/space48/magento2-code-quality/script/add-hook.sh
vendor/space48/magento2-code-quality/script/add-hook.sh
analyse: ## analyses all code from starting commit hash to HEAD
git diff ${CQ_STARTING_COMMIT_HASH}..HEAD | warden env exec -T php-fpm 'vendor/phpro/grumphp/bin/grumphp' run
analyse-fix: ## analyses all code from starting commit hash to HEAD and fixes all autofixable errors
git diff ${CQ_STARTING_COMMIT_HASH}..HEAD | warden env exec -T php-fpm 'vendor/phpro/grumphp/bin/grumphp' run --fix
precommit: ## analyses code staged for commit
git diff --staged | warden env exec -T php-fpm 'vendor/phpro/grumphp/bin/grumphp' run
precommit-fix: ## analyses code staged for commit and fixes all autofixable errors
git diff --staged | warden env exec -T php-fpm 'vendor/phpro/grumphp/bin/grumphp' run --fix
analyse-ci: # Called during build on CI
git fetch --shallow-since=${CQ_STARTING_COMMIT_DATE}
git diff ${CQ_STARTING_COMMIT_HASH}..HEAD | vendor/phpro/grumphp/bin/grumphp run