Skip to content

Commit 1283d8a

Browse files
committed
S48-634: CLI command for autofix errors that can be autofixed
- bug fix
1 parent dc589db commit 1283d8a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,9 @@ It contains following commands:
155155

156156
- `linters-init` - init linters on local machine
157157
- `analyse` - analyses all code from starting commit hash to HEAD
158-
- `fix` - analyses all code from starting commit hash to HEAD
158+
- `analuse-fix` - analyses all code from starting commit hash to HEAD and fixes autofixable errors
159159
- `precommit` - analyses code staged for commit
160+
- `precommit-fix` - analyses code staged for commit and fixes autofixable errors
160161
- `analyse-ci` - Same as 'analyse' but modified to be called during build on CI env
161162

162163
Update `CQ_STARTING_COMMIT_HASH` variable. Replace the sample `a000z999` commit hash with the hash from the project where you want to start linting from.

code-quality.mk

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
### Code Quality section
2-
CQ_STARTING_COMMIT_HASH='a000z999'
3-
CQ_STARTING_COMMIT_DATE='01/01/2021'
42

53
linters-init: ## init linters on local machine
64
warden env exec php-fpm chmod +x vendor/space48/magento2-code-quality/script/install.sh
@@ -12,12 +10,15 @@ linters-init: ## init linters on local machine
1210
analyse: ## analyses all code from starting commit hash to HEAD
1311
git diff ${CQ_STARTING_COMMIT_HASH}..HEAD | warden env run --rm php-fpm 'vendor/phpro/grumphp/bin/grumphp' run
1412

15-
fix: ## analyses all code from starting commit hash to HEAD
13+
analyse-fix: ## analyses all code from starting commit hash to HEAD and fixes all autofixable errors
1614
git diff ${CQ_STARTING_COMMIT_HASH}..HEAD | warden env run --rm php-fpm 'vendor/phpro/grumphp/bin/grumphp' run --fix
1715

1816
precommit: ## analyses code staged for commit
1917
git diff --staged | warden env run --rm php-fpm 'vendor/phpro/grumphp/bin/grumphp' run
2018

19+
precommit-fix: ## analyses code staged for commit and fixes all autofixable errors
20+
git diff --staged | warden env run --rm php-fpm 'vendor/phpro/grumphp/bin/grumphp' run --fix
21+
2122
analyse-ci: # Called during build on CI
2223
git fetch --shallow-since=${CQ_STARTING_COMMIT_DATE}
2324
git diff ${CQ_STARTING_COMMIT_HASH}..HEAD | vendor/phpro/grumphp/bin/grumphp run

0 commit comments

Comments
 (0)