Proposal of enabled linters and their settings. (#8951)
* Proposal of enabled linters and their settings. * Workaround to skip weird "plugins/parsers/influx/plugins/parsers/influx" directory * Update to reflect changes in github actions * Back to the last state * Fix Co-authored-by: Pawel Zak <Pawel Zak> Co-authored-by: Sebastian Spaink <sspaink@influxdata.com>
This commit is contained in:
parent
97da596275
commit
9ddd189cd3
|
|
@ -21,7 +21,6 @@ jobs:
|
||||||
with:
|
with:
|
||||||
version: v1.38
|
version: v1.38
|
||||||
only-new-issues: true
|
only-new-issues: true
|
||||||
args: --timeout=5m0s
|
|
||||||
golangci-master:
|
golangci-master:
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
name: lint-master-all
|
name: lint-master-all
|
||||||
|
|
@ -33,4 +32,4 @@ jobs:
|
||||||
with:
|
with:
|
||||||
version: v1.38
|
version: v1.38
|
||||||
only-new-issues: true
|
only-new-issues: true
|
||||||
args: --timeout=5m0s --issues-exit-code=0
|
args: --issues-exit-code=0
|
||||||
|
|
|
||||||
154
.golangci.yml
154
.golangci.yml
|
|
@ -1,36 +1,138 @@
|
||||||
linters:
|
linters:
|
||||||
enable:
|
enable:
|
||||||
|
- bodyclose
|
||||||
|
- dogsled
|
||||||
|
- errcheck
|
||||||
|
- goprintffuncname
|
||||||
|
- gosimple
|
||||||
|
- govet
|
||||||
|
- ineffassign
|
||||||
|
- nakedret
|
||||||
|
- nilerr
|
||||||
|
- predeclared
|
||||||
- revive
|
- revive
|
||||||
|
- sqlclosecheck
|
||||||
|
- staticcheck
|
||||||
|
- typecheck
|
||||||
|
- unconvert
|
||||||
|
- unparam
|
||||||
|
- unused
|
||||||
|
- varcheck
|
||||||
|
disable:
|
||||||
|
- asciicheck
|
||||||
|
- deadcode
|
||||||
|
- depguard
|
||||||
|
- dupl
|
||||||
|
- exhaustive
|
||||||
|
- funlen
|
||||||
|
- gci
|
||||||
|
- gochecknoglobals
|
||||||
|
- gochecknoinits
|
||||||
|
- gocognit
|
||||||
|
- goconst
|
||||||
|
- gocritic
|
||||||
|
- gocyclo
|
||||||
|
- godot
|
||||||
|
- godox
|
||||||
|
- goerr113
|
||||||
|
- gofmt
|
||||||
|
- gofumpt
|
||||||
|
- goheader
|
||||||
|
- goimports
|
||||||
|
- golint
|
||||||
|
- gomnd
|
||||||
|
- gomodguard
|
||||||
|
- gosec
|
||||||
|
- ifshort
|
||||||
|
- interfacer
|
||||||
|
- lll
|
||||||
|
- makezero
|
||||||
|
- maligned
|
||||||
|
- megacheck
|
||||||
|
- misspell
|
||||||
|
- nestif
|
||||||
|
- nlreturn
|
||||||
|
- noctx
|
||||||
|
- nolintlint
|
||||||
|
- paralleltest
|
||||||
|
- prealloc
|
||||||
|
- rowserrcheck
|
||||||
|
- scopelint
|
||||||
|
- structcheck
|
||||||
|
- stylecheck
|
||||||
|
- testpackage
|
||||||
|
- thelper
|
||||||
|
- tparallel
|
||||||
|
- wastedassign
|
||||||
|
- whitespace
|
||||||
|
- wrapcheck
|
||||||
|
- wsl
|
||||||
|
|
||||||
linters-settings:
|
linters-settings:
|
||||||
revive:
|
revive:
|
||||||
rules:
|
rules:
|
||||||
|
- name: argument-limit
|
||||||
|
arguments: [ 6 ]
|
||||||
|
- name: atomic
|
||||||
|
- name: bare-return
|
||||||
- name: blank-imports
|
- name: blank-imports
|
||||||
|
- name: bool-literal-in-expr
|
||||||
|
- name: call-to-gc
|
||||||
|
- name: confusing-naming
|
||||||
|
- name: confusing-results
|
||||||
|
- name: constant-logical-expr
|
||||||
- name: context-as-argument
|
- name: context-as-argument
|
||||||
- name: context-keys-type
|
- name: context-keys-type
|
||||||
|
- name: deep-exit
|
||||||
|
- name: defer
|
||||||
- name: dot-imports
|
- name: dot-imports
|
||||||
|
- name: duplicated-imports
|
||||||
|
- name: early-return
|
||||||
|
- name: empty-block
|
||||||
|
- name: empty-lines
|
||||||
|
- name: error-naming
|
||||||
- name: error-return
|
- name: error-return
|
||||||
- name: error-strings
|
- name: error-strings
|
||||||
- name: error-naming
|
- name: errorf
|
||||||
- name: exported
|
- name: flag-parameter
|
||||||
|
- name: function-result-limit
|
||||||
|
arguments: [ 3 ]
|
||||||
|
- name: identical-branches
|
||||||
- name: if-return
|
- name: if-return
|
||||||
|
- name: imports-blacklist
|
||||||
|
arguments: [ "log" ]
|
||||||
|
- name: import-shadowing
|
||||||
- name: increment-decrement
|
- name: increment-decrement
|
||||||
- name: var-naming
|
- name: indent-error-flow
|
||||||
- name: var-declaration
|
- name: modifies-parameter
|
||||||
|
- name: modifies-value-receiver
|
||||||
- name: package-comments
|
- name: package-comments
|
||||||
- name: range
|
- name: range
|
||||||
|
- name: range-val-address
|
||||||
|
- name: range-val-in-closure
|
||||||
- name: receiver-naming
|
- name: receiver-naming
|
||||||
- name: time-naming
|
|
||||||
- name: unexported-return
|
|
||||||
- name: indent-error-flow
|
|
||||||
- name: errorf
|
|
||||||
- name: empty-block
|
|
||||||
- name: superfluous-else
|
|
||||||
- name: unused-parameter
|
|
||||||
- name: unreachable-code
|
|
||||||
- name: redefines-builtin-id
|
- name: redefines-builtin-id
|
||||||
|
- name: string-of-int
|
||||||
|
- name: struct-tag
|
||||||
|
- name: superfluous-else
|
||||||
|
- name: time-naming
|
||||||
|
- name: unconditional-recursion
|
||||||
|
- name: unexported-naming
|
||||||
|
- name: unhandled-error
|
||||||
|
- name: unnecessary-stmt
|
||||||
|
- name: unreachable-code
|
||||||
|
- name: unused-parameter
|
||||||
|
- name: var-declaration
|
||||||
|
- name: var-naming
|
||||||
|
- name: waitgroup-by-value
|
||||||
|
nakedret:
|
||||||
|
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
|
||||||
|
max-func-lines: 1
|
||||||
|
|
||||||
run:
|
run:
|
||||||
|
# timeout for analysis, e.g. 30s, 5m, default is 1m
|
||||||
|
timeout: 5m
|
||||||
|
|
||||||
# which dirs to skip: issues from them won't be reported;
|
# which dirs to skip: issues from them won't be reported;
|
||||||
# can use regexp here: generated.*, regexp is applied on full path;
|
# can use regexp here: generated.*, regexp is applied on full path;
|
||||||
# default value is empty list, but default dirs are skipped independently
|
# default value is empty list, but default dirs are skipped independently
|
||||||
|
|
@ -38,9 +140,10 @@ run:
|
||||||
# "/" will be replaced by current OS file path separator to properly work
|
# "/" will be replaced by current OS file path separator to properly work
|
||||||
# on Windows.
|
# on Windows.
|
||||||
skip-dirs:
|
skip-dirs:
|
||||||
- scripts
|
- assets
|
||||||
- docs
|
- docs
|
||||||
- etc
|
- etc
|
||||||
|
- scripts
|
||||||
|
|
||||||
# which files to skip: they will be analyzed, but issues from them
|
# which files to skip: they will be analyzed, but issues from them
|
||||||
# won't be reported. Default value is empty list, but there is
|
# won't be reported. Default value is empty list, but there is
|
||||||
|
|
@ -52,17 +155,24 @@ run:
|
||||||
- plugins/parsers/influx/machine.go*
|
- plugins/parsers/influx/machine.go*
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
# List of regexps of issue texts to exclude, empty list by default.
|
|
||||||
# But independently from this option we use default exclude patterns,
|
|
||||||
# it can be disabled by `exclude-use-default: false`. To list all
|
|
||||||
# excluded by default patterns execute `golangci-lint run --help`
|
|
||||||
exclude:
|
|
||||||
- don't use an underscore in package name
|
|
||||||
- exported.*should have comment.*or be unexported
|
|
||||||
- comment on exported.*should be of the form
|
|
||||||
|
|
||||||
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
|
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
|
||||||
max-issues-per-linter: 0
|
max-issues-per-linter: 0
|
||||||
|
|
||||||
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
|
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
|
||||||
max-same-issues: 0
|
max-same-issues: 0
|
||||||
|
|
||||||
|
exclude:
|
||||||
|
- don't use an underscore in package name #revive:var-naming
|
||||||
|
|
||||||
|
exclude-rules:
|
||||||
|
- path: plugins/parsers/influx
|
||||||
|
linters:
|
||||||
|
- govet
|
||||||
|
|
||||||
|
# Show only new issues created after git revision `HEAD~`
|
||||||
|
# Great for CI setups
|
||||||
|
# It's not practical to fix all existing issues at the moment of integration: much better to not allow issues in new code.
|
||||||
|
# new-from-rev: "HEAD~"
|
||||||
|
|
||||||
|
output:
|
||||||
|
format: tab
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue