stash/.golangci.yml

73 lines
1.6 KiB
YAML
Raw Normal View History

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
issues:
# Rev at which the linter was introduced. Older bugs are still
# present, but should not be considered validation errors for now
new-from-rev: b14d5c56504dfcea2f5a7b86706b0ecdafd0b68c
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
- name: redefines-builtin-id
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
- gofmt
- revive