forked from gopasspw/gopass
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrating to Golangci-Lint (gopasspw#2075)
* Migrating to Golangci-Lint Adding a GHA that is currently not running automatically until it's supporting Go 1.18 Adding the proper config files for Golangci-lint Removing codequality from CI in Makefile phasing out some of the codequality linters too since they are in golangci already RELEASE_NOTES=n/a Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com> * Finalizing all tests with Go 1.18 RELEASE_NOTES=n/a Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>
- Loading branch information
1 parent
6a8fb86
commit ad47305
Showing
3 changed files
with
108 additions
and
24 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,25 @@ | ||
name: golangci-lint | ||
on: | ||
workflow_dispatch: | ||
# push: # Disabled until Golangci-lint GHA is compiled with Go 1.18 | ||
# tags: | ||
# - v* | ||
# branches: | ||
# - master | ||
# - main | ||
# pull_request: | ||
permissions: | ||
contents: read | ||
pull-requests: read | ||
jobs: | ||
golangci: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v2 | ||
with: | ||
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version | ||
version: latest # we have a linter whitelist in our .golangci.yml config file | ||
only-new-issues: true |
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,75 @@ | ||
linters-settings: | ||
gocyclo: | ||
min-complexity: 22 | ||
staticcheck: | ||
go: "1.18" | ||
# https://staticcheck.io/docs/options#checks | ||
checks: ["all","-SA1019"] | ||
|
||
linters: | ||
disable-all: true | ||
|
||
enable: | ||
- asciicheck | ||
- forcetypeassert | ||
- gci | ||
- gocyclo | ||
- gofmt | ||
- goimports | ||
- gomoddirectives | ||
- gomodguard | ||
- goprintffuncname | ||
- ifshort | ||
- ineffassign | ||
- misspell | ||
- nakedret | ||
- nolintlint | ||
- prealloc | ||
- predeclared | ||
## These are working but disabled for now | ||
## - dogsled # two occurences we cannot really correct | ||
## - dupl # some dups in tests | ||
## - gochecknoinits # we use a lot of init | ||
## - goconst # annoying? | ||
## - godot # annoying? | ||
## - godox # we have a few todo... | ||
## - nestif # some work to refactor | ||
## - paralleltest # lots of work to pass | ||
## - revive # currently a bit buggy with Go 1.18 but works mostly | ||
## - tagliatelle # requires some refactoring | ||
## - testpackage # complains for a lot of packages | ||
|
||
## To enable once they work with Go 1.18: | ||
### - deadcode | ||
### - depguard | ||
### - durationcheck | ||
### - errcheck | ||
### - errorlint | ||
### - exhaustive | ||
### - exportloopref | ||
### - gocritic | ||
### - goerr113 | ||
### - gosec | ||
### - gosimple | ||
### - govet | ||
### - importas | ||
### - makezero | ||
### - nilerr | ||
### - rowserrcheck | ||
### - staticcheck | ||
### - structcheck | ||
### - stylecheck | ||
### - thelper | ||
### - tparallel | ||
### - typecheck | ||
### - unconvert | ||
### - unparam | ||
### - unused | ||
### - varcheck | ||
### - wastedassign | ||
### - wrapcheck | ||
|
||
issues: | ||
exclude-use-default: false # disable filtering of defaults for better zero-issue policy | ||
max-per-linter: 0 # disable limit; report all issues of a linter | ||
max-same-issues: 0 # disable limit; report all issues of the same issue |
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