Add golangci-lint workflow (#1759)
* Add golangci-lint workflow
* Add a bit more lenient linter timeout
1 Minute isn't always enough, so bump to 3.
* Document golangci, add make target
Document how to get golangci-lint in the README file. While here,
provide a QOL target in the makefile
for the linter, and make it part of validation.
* Introduce .golangci.yml
This is the default golangci-lint configuration file location. Use it.
Move configuration into the yaml file, and enable the default set of
linters; we know we pass most of those.
* Add gofmt and revive to golangci-lint
Read the golangci-lint source code to figure out the configuration format.
Copy the configuration from `revive.toml` into the linter configuration.
* Do not set simplify on gofmt
The project currently runs without simplify. So for consistency, don't
make that a requirement for the linter.
* Add new-from-rev
Older issues should not be considered a failure for new PRs and issues.
Use new-from-from to make the current develop as the point-in-time for
when we consider errors.
Once in the tree, we can go and fix the older errors in separate
patches, taking a little bit at a time.
* Move to golangci-lint
Rewrite the way we run targets in the makefile, so it is split between
frontend and backend.
Use the frontend build steps in build.yml
Update README to reflect the new world order.
* Remove check-gofmt.sh
The tool now runs as part of golangci-lint, in particular through the
'validate' target in the Makefile.
* Remove targets for golangci-lint
Fold these targets into the `lint` target. While here, update README.
2021-09-27 00:41:59 +00:00
|
|
|
# options for analysis running
|
|
|
|
run:
|
|
|
|
timeout: 3m
|
|
|
|
modules-download-mode: vendor
|
|
|
|
|
2021-09-27 23:29:45 +00:00
|
|
|
linters:
|
|
|
|
disable-all: true
|
|
|
|
enable:
|
|
|
|
# Default set of linters from golangci-lint
|
|
|
|
- deadcode
|
|
|
|
- errcheck
|
|
|
|
- gosimple
|
|
|
|
- govet
|
|
|
|
- ineffassign
|
|
|
|
- staticcheck
|
|
|
|
- structcheck
|
|
|
|
- typecheck
|
|
|
|
- unused
|
|
|
|
- varcheck
|
|
|
|
# Linters added by the stash project
|
2021-10-03 00:48:03 +00:00
|
|
|
# - bodyclose
|
|
|
|
- dogsled
|
|
|
|
# - errorlint
|
|
|
|
# - exhaustive
|
|
|
|
- exportloopref
|
|
|
|
# - goconst
|
|
|
|
# - gocritic
|
|
|
|
# - goerr113
|
2021-09-27 23:29:45 +00:00
|
|
|
- gofmt
|
2021-10-03 00:48:03 +00:00
|
|
|
# - gosec
|
|
|
|
# - ifshort
|
|
|
|
- misspell
|
|
|
|
# - nakedret
|
|
|
|
# - noctx
|
|
|
|
# - paralleltest
|
2021-09-27 23:29:45 +00:00
|
|
|
- revive
|
2021-10-03 00:48:03 +00:00
|
|
|
- rowserrcheck
|
|
|
|
- sqlclosecheck
|
Add golangci-lint workflow (#1759)
* Add golangci-lint workflow
* Add a bit more lenient linter timeout
1 Minute isn't always enough, so bump to 3.
* Document golangci, add make target
Document how to get golangci-lint in the README file. While here,
provide a QOL target in the makefile
for the linter, and make it part of validation.
* Introduce .golangci.yml
This is the default golangci-lint configuration file location. Use it.
Move configuration into the yaml file, and enable the default set of
linters; we know we pass most of those.
* Add gofmt and revive to golangci-lint
Read the golangci-lint source code to figure out the configuration format.
Copy the configuration from `revive.toml` into the linter configuration.
* Do not set simplify on gofmt
The project currently runs without simplify. So for consistency, don't
make that a requirement for the linter.
* Add new-from-rev
Older issues should not be considered a failure for new PRs and issues.
Use new-from-from to make the current develop as the point-in-time for
when we consider errors.
Once in the tree, we can go and fix the older errors in separate
patches, taking a little bit at a time.
* Move to golangci-lint
Rewrite the way we run targets in the makefile, so it is split between
frontend and backend.
Use the frontend build steps in build.yml
Update README to reflect the new world order.
* Remove check-gofmt.sh
The tool now runs as part of golangci-lint, in particular through the
'validate' target in the Makefile.
* Remove targets for golangci-lint
Fold these targets into the `lint` target. While here, update README.
2021-09-27 00:41:59 +00:00
|
|
|
|
|
|
|
linters-settings:
|
|
|
|
gofmt:
|
|
|
|
simplify: false
|
|
|
|
|
|
|
|
revive:
|
|
|
|
ignore-generated-header: true
|
|
|
|
severity: error
|
|
|
|
confidence: 0.8
|
|
|
|
error-code: 1
|
|
|
|
warning-code: 1
|
|
|
|
rules:
|
|
|
|
- name: blank-imports
|
|
|
|
disabled: true
|
|
|
|
- name: context-as-argument
|
|
|
|
- name: context-keys-type
|
|
|
|
- name: dot-imports
|
|
|
|
- name: error-return
|
|
|
|
- name: error-strings
|
|
|
|
- name: error-naming
|
|
|
|
- name: exported
|
|
|
|
disabled: true
|
|
|
|
- name: if-return
|
|
|
|
disabled: true
|
|
|
|
- name: increment-decrement
|
|
|
|
- name: var-naming
|
|
|
|
disabled: true
|
|
|
|
- name: var-declaration
|
|
|
|
- name: package-comments
|
|
|
|
- name: range
|
|
|
|
- name: receiver-naming
|
|
|
|
- name: time-naming
|
|
|
|
- name: unexported-return
|
|
|
|
disabled: true
|
|
|
|
- name: indent-error-flow
|
|
|
|
disabled: true
|
|
|
|
- name: errorf
|
|
|
|
- name: empty-block
|
|
|
|
disabled: true
|
|
|
|
- name: superfluous-else
|
|
|
|
- name: unused-parameter
|
|
|
|
disabled: true
|
|
|
|
- name: unreachable-code
|
2021-10-03 00:48:03 +00:00
|
|
|
- name: redefines-builtin-id
|