forked from opendatahub-io/opendatahub-operator
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Linter: add golangci-linter and fix issues (opendatahub-io#540)
- Update Makefile - Add linter in GH action and make target to download binary - set timeout for 5m for GH aciton when cache is not hit - set to use 1.54.0 of golangci-lint - add lll linter and set to 180, skip lines out of range - set max-complicity back to default 30, skip lines out of scope - disable degarud linter Fix linter after adding function test on DSCI Signed-off-by: Wen Zhou <[email protected]> Co-authored-by: Bartosz Majsak <[email protected]>
- Loading branch information
1 parent
dbab421
commit aacee48
Showing
35 changed files
with
372 additions
and
294 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: linters | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- incubation | ||
pull_request: | ||
jobs: | ||
golangci: | ||
name: golangci-lint | ||
runs-on: ubuntu-latest | ||
env: | ||
REPOSITORY: ${{ github.repository }} | ||
steps: | ||
- name: Set up Go env | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.18 | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: go/src/github.com/${{ env.REPOSITORY }} | ||
- name: Set $GOPATH | ||
run: | | ||
echo "GOPATH=${{ github.workspace }}/go" >> $GITHUB_ENV | ||
echo "${{ github.workspace }}/go/bin" >> $GITHUB_PATH | ||
shell: bash | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.54.0 | ||
working-directory: go/src/github.com/${{ env.REPOSITORY }} | ||
args: --timeout 5m0s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
linters-settings: | ||
gocyclo: | ||
min-complexity: 30 | ||
lll: | ||
line-length: 180 | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- bodyclose | ||
- dogsled | ||
- dupl | ||
- errcheck | ||
- exportloopref | ||
- goconst | ||
- gocritic | ||
- gocyclo | ||
- gofmt | ||
- goprintffuncname | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- misspell | ||
- nakedret | ||
- nolintlint | ||
- staticcheck | ||
- stylecheck | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
- whitespace | ||
- lll | ||
|
||
issues: | ||
exclude-rules: | ||
- path: tests/e2e/(.+)_test\.go | ||
linters: | ||
- typecheck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.