Skip to content

Commit

Permalink
fix: Check linter configuration
Browse files Browse the repository at this point in the history
Signed-off-by: Mateus Oliveira <[email protected]>
  • Loading branch information
mateusoliveira43 committed Dec 13, 2024
1 parent 43ee3f6 commit d768290
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 28 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/lint-sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ on:
jobs:
lint-samples:
runs-on: ubuntu-latest
strategy:
matrix:
folder: [
"testdata/project-v4",
"testdata/project-v4-with-plugins",
"testdata/project-v4-multigroup"
]
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
steps:
- name: Clone the code
Expand All @@ -22,12 +29,9 @@ jobs:
- name: Run linter
uses: golangci/golangci-lint-action@v6
with:
version: v1.59
working-directory: testdata/project-v4
args: --config .golangci.yml ./...
- name: Run linter
uses: golangci/golangci-lint-action@v6
with:
version: v1.59
working-directory: testdata/project-v4-with-plugins
version: v1.61.0
working-directory: ${{ matrix.folder }}
args: --config .golangci.yml ./...
- name: Check linter configuration
working-directory: ${{ matrix.folder }}
run: make lint-config
4 changes: 3 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ jobs:
- name: Run linter
uses: golangci/golangci-lint-action@v6
with:
version: v1.61
version: v1.61.0
- name: Check linter configuration
run: make lint-config

yamllint:
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ issues:

linters-settings:
govet:
enable=fieldalignment: true
enable-all: true
revive:
rules:
# The following rules are recommended https://github.com/mgechev/revive#recommended-configuration
Expand All @@ -28,7 +28,7 @@ linters-settings:
- name: dot-imports
arguments:
# dot import should be ONLY allowed for ginkgo testing packages
allowedPackages:
- allowedPackages:
- "github.com/onsi/ginkgo/v2"
- "github.com/onsi/gomega"
- name: error-return
Expand Down Expand Up @@ -66,9 +66,9 @@ linters-settings:
linters:
disable-all: true
enable:
- copyloopvar
- dupl
- errcheck
- copyloopvar
- ginkgolinter
- goconst
- gocyclo
Expand Down
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,16 @@ generate-charts: build ## Re-generate the helm chart testdata only
check-docs: ## Run the script to ensure that the docs are updated
./hack/docs/check.sh

.PHONY: lint-config
lint-config: golangci-lint ## Verify golangci-lint linter configuration
$(GOLANGCI_LINT) config verify

.PHONY: lint
lint: golangci-lint yamllint ## Run golangci-lint linter & yamllint
lint: lint-config yamllint ## Run golangci-lint linter & yamllint
$(GOLANGCI_LINT) run

.PHONY: lint-fix
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
lint-fix: lint-config ## Run golangci-lint linter and perform fixes
$(GOLANGCI_LINT) run --fix

.PHONY: yamllint
Expand Down
8 changes: 6 additions & 2 deletions docs/book/src/cronjob-tutorial/testdata/project/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,16 @@ test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated
}
go test ./test/e2e/ -v -ginkgo.v

.PHONY: lint-config
lint-config: golangci-lint ## Verify golangci-lint linter configuration
$(GOLANGCI_LINT) config verify

.PHONY: lint
lint: golangci-lint ## Run golangci-lint linter
lint: lint-config ## Run golangci-lint linter
$(GOLANGCI_LINT) run

.PHONY: lint-fix
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
lint-fix: lint-config ## Run golangci-lint linter and perform fixes
$(GOLANGCI_LINT) run --fix

##@ Build
Expand Down
8 changes: 6 additions & 2 deletions docs/book/src/getting-started/testdata/project/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,16 @@ test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated
}
go test ./test/e2e/ -v -ginkgo.v

.PHONY: lint-config
lint-config: golangci-lint ## Verify golangci-lint linter configuration
$(GOLANGCI_LINT) config verify

.PHONY: lint
lint: golangci-lint ## Run golangci-lint linter
lint: lint-config ## Run golangci-lint linter
$(GOLANGCI_LINT) run

.PHONY: lint-fix
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
lint-fix: lint-config ## Run golangci-lint linter and perform fixes
$(GOLANGCI_LINT) run --fix

##@ Build
Expand Down
8 changes: 6 additions & 2 deletions docs/book/src/multiversion-tutorial/testdata/project/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,16 @@ test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated
}
go test ./test/e2e/ -v -ginkgo.v

.PHONY: lint-config
lint-config: golangci-lint ## Verify golangci-lint linter configuration
$(GOLANGCI_LINT) config verify

.PHONY: lint
lint: golangci-lint ## Run golangci-lint linter
lint: lint-config ## Run golangci-lint linter
$(GOLANGCI_LINT) run

.PHONY: lint-fix
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
lint-fix: lint-config ## Run golangci-lint linter and perform fixes
$(GOLANGCI_LINT) run --fix

##@ Build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,16 @@ test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated
}
go test ./test/e2e/ -v -ginkgo.v
.PHONY: lint-config
lint-config: golangci-lint ## Verify golangci-lint linter configuration
$(GOLANGCI_LINT) config verify
.PHONY: lint
lint: golangci-lint ## Run golangci-lint linter
lint: lint-config ## Run golangci-lint linter
$(GOLANGCI_LINT) run
.PHONY: lint-fix
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
lint-fix: lint-config ## Run golangci-lint linter and perform fixes
$(GOLANGCI_LINT) run --fix
##@ Build
Expand Down
8 changes: 6 additions & 2 deletions testdata/project-v4-multigroup/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,16 @@ test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated
}
go test ./test/e2e/ -v -ginkgo.v

.PHONY: lint-config
lint-config: golangci-lint ## Verify golangci-lint linter configuration
$(GOLANGCI_LINT) config verify

.PHONY: lint
lint: golangci-lint ## Run golangci-lint linter
lint: lint-config ## Run golangci-lint linter
$(GOLANGCI_LINT) run

.PHONY: lint-fix
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
lint-fix: lint-config ## Run golangci-lint linter and perform fixes
$(GOLANGCI_LINT) run --fix

##@ Build
Expand Down
8 changes: 6 additions & 2 deletions testdata/project-v4-with-plugins/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,16 @@ test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated
}
go test ./test/e2e/ -v -ginkgo.v

.PHONY: lint-config
lint-config: golangci-lint ## Verify golangci-lint linter configuration
$(GOLANGCI_LINT) config verify

.PHONY: lint
lint: golangci-lint ## Run golangci-lint linter
lint: lint-config ## Run golangci-lint linter
$(GOLANGCI_LINT) run

.PHONY: lint-fix
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
lint-fix: lint-config ## Run golangci-lint linter and perform fixes
$(GOLANGCI_LINT) run --fix

##@ Build
Expand Down
8 changes: 6 additions & 2 deletions testdata/project-v4/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,16 @@ test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated
}
go test ./test/e2e/ -v -ginkgo.v

.PHONY: lint-config
lint-config: golangci-lint ## Verify golangci-lint linter configuration
$(GOLANGCI_LINT) config verify

.PHONY: lint
lint: golangci-lint ## Run golangci-lint linter
lint: lint-config ## Run golangci-lint linter
$(GOLANGCI_LINT) run

.PHONY: lint-fix
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
lint-fix: lint-config ## Run golangci-lint linter and perform fixes
$(GOLANGCI_LINT) run --fix

##@ Build
Expand Down

0 comments on commit d768290

Please sign in to comment.