Skip to content

Commit 98d86ac

Browse files
improvements in the make targets for lint checks and automatically fixes (#2379)
- Add target to fix issues automatically - Add target to check just the ci lint locally
1 parent 711c843 commit 98d86ac

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

Makefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,15 @@ tidy: ## Update dependencies
6969
clean: ## Clean up the build artifacts
7070
$(Q)rm -rf build
7171

72-
lint: ## Run golangci-lint with all checks enabled (development purpose only)
72+
lint-dev: ## Run golangci-lint with all checks enabled (development purpose only)
7373
./hack/tests/check-lint.sh dev
7474

75+
lint-fix: ## Run golangci-lint automatically fix (development purpose only)
76+
./hack/tests/check-lint.sh fix
77+
78+
lint: ## Run golangci-lint with all checks enabled in the ci
79+
./hack/tests/check-lint.sh ci
80+
7581
##############################
7682
# Generate Artifacts #
7783
##############################
@@ -181,9 +187,8 @@ test: test-unit ## Run the tests
181187
test-markdown test/markdown:
182188
./hack/ci/marker
183189

184-
test-sanity test/sanity: tidy build/operator-sdk
190+
test-sanity test/sanity: tidy build/operator-sdk lint
185191
./hack/tests/sanity-check.sh
186-
./hack/tests/check-lint.sh ci
187192

188193
TEST_PKGS:=$(shell go list ./... | grep -v -P 'github.com/operator-framework/operator-sdk/(hack|test/e2e)')
189194
test-unit test/unit: ## Run the unit tests

hack/tests/check-lint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,17 @@ DEV_LINTERS=(
1919
"--enable=gosec" # NOT add this one to CI since was defined that it should be optional for now at least.
2020
)
2121

22+
# Some lint checks can be fixed automatically by using it.
23+
FIX_LINTERS=(
24+
"--fix"
25+
)
26+
2227
subcommand=$1
2328
case $subcommand in
29+
"fix")
30+
header_text "Running lint check with automatically fix"
31+
LINTERS=${FIX_LINTERS[@]}
32+
;;
2433
"dev")
2534
##todo(camilamacedo86): It should be removed when all linter checks be enabled
2635
header_text "Checking the project with all linters (dev)"

0 commit comments

Comments
 (0)