diff options
| author | Taras Madan <tarasmadan@google.com> | 2025-07-15 15:27:41 +0200 |
|---|---|---|
| committer | Taras Madan <tarasmadan@google.com> | 2025-07-17 08:31:25 +0000 |
| commit | a81f309b57265e5760b926274e1f1681e7550e41 (patch) | |
| tree | 49628dfa508eeb8c679647b08e5e22ad44b133cb /.golangci.yml | |
| parent | 44f8051e446824395d02720c745353cd454d9553 (diff) | |
go.mod: update golangci-lint to v2
Typecheck is not a linter: https://golangci-lint.run/welcome/faq/#why-do-you-have-typecheck-errors .
The linters stylecheck, gosimple, and staticcheck has been merged inside the staticcheck.
Net config format.
goconst.ignore-tests doesn't exist anymore.
print-linter-name is replaced by print-issued-lines.
Github can parse golangci-lint output. --output-format is not needed anymore.
Diffstat (limited to '.golangci.yml')
| -rw-r--r-- | .golangci.yml | 156 |
1 files changed, 84 insertions, 72 deletions
diff --git a/.golangci.yml b/.golangci.yml index 6876b43ce..b4ebb033f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,8 +1,10 @@ # Copyright 2019 syzkaller project authors. All rights reserved. # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. +version: "2" + run: - deadline: 8m + timeout: 8m # Autogenerated files take too much time and memory to load, # even if we skip them with issues.exclude-dirs. # So we define this tag and use it in the autogenerated files. @@ -10,21 +12,26 @@ run: - codeanalysis output: - print-linter-name: false + formats: + text: + print-issued-lines: false + +formatters: + enable: + - gofmt + disable: + - goimports linters: enable: - lll - govet - - gofmt - revive - unconvert - goconst - unused - - gosimple - misspell - gocyclo - - stylecheck - govet - whitespace - nestif @@ -44,12 +51,10 @@ linters: - gochecknoglobals - gochecknoinits - godox - - goimports - gomodguard - gosec - rowserrcheck - testpackage - - typecheck - ineffassign # errcheck would be good to enable, but we need to fix existing warnings first. - errcheck @@ -58,72 +63,79 @@ linters: - prealloc - gocritic - wsl - -linters-settings: - revive: + settings: + revive: + rules: + - name: package-comments + disabled: true + - name: argument-limit + arguments: [ 7 ] + lll: + line-length: 120 + gocyclo: + # TODO: consider reducing this value. + min-complexity: 24 + dupl: + threshold: 60 + goconst: + min-len: 3 + min-occurrences: 3 + ignore-string-values: ['\.html|^true$'] + nestif: + # TODO: consider reducing this value. + min-complexity: 12 + staticcheck: + checks: + - all + - -ST1000 # at least one file in a package should have a package comment + - -ST1020 # comment on exported function Foo should be of the form "Foo ..." + - -ST1021 # comment on exported type Foo should be of the form "Foo ..." (with optional leading article) + - -ST1022 # comment on exported const Foo should be of the form "Foo ..." + - -QF1008 # could remove embedded field "..." from selector + godot: + scope: toplevel + exclude: ["keep-sorted"] + gocognit: + # TODO: consider reducing this value. + min-complexity: 70 + funlen: + # TODO: consider reducing these value. + lines: 140 + statements: 80 + custom: + syz-linter: + path: bin/syz-linter.so + errorlint: + comparison: false # we want to use "err == iterator.Done" + exclusions: + warn-unused: true # Log a warning if an exclusion path is unused. rules: - - name: package-comments - disabled: true - - name: argument-limit - arguments: [ 7 ] - lll: - line-length: 120 - gocyclo: - # TODO: consider reducing this value. - min-complexity: 24 - dupl: - threshold: 60 - goconst: - min-len: 3 - min-occurrences: 3 - ignore-tests: true # re-enable once goconst 1.7.0+ merged into golangci-lint - ignore-strings: '\.html|^true$' - nestif: - # TODO: consider reducing this value. - min-complexity: 12 - godot: - scope: toplevel - exclude: "keep-sorted" - gocognit: - # TODO: consider reducing this value. - min-complexity: 70 - funlen: - # TODO: consider reducing these value. - lines: 140 - statements: 80 - custom: - syz-linter: - path: bin/syz-linter.so - errorlint: - comparison: false # we want to use "err == iterator.Done" - -issues: - exclude-use-default: false - exclude-dirs: - - pkg/kd - - tools/syz-trace2syz - max-same-issues: 0 - exclude: - - "exported .* should have comment" - - "comment on .* should be of the form" - - "at least one file in a package should have a package comment" - # This check gives false positives related to the standard log.Fatalf - # (which is strange, standard log package should be supported).# - - "SA5011: possible nil pointer dereference" - - "this check suggests that the pointer can be nil" - exclude-rules: - - path: (pkg/csource/generated.go|pkg/build/linux_generated.go) - linters: + - path: (pkg/csource/generated.go|pkg/build/linux_generated.go) + linters: - lll - - path: (sys/.*/init.*|sys/targets/common.go) - text: "don't use ALL_CAPS in Go names|should not use ALL_CAPS in Go names" - - path: (prog/.*) - text: "methods on the same type should have the same receiver name" - - path: (dashboard/app/.*_test\.go) - linters: + - path: (sys/.*/init.*|sys/targets/common.go) + text: "don't use ALL_CAPS in Go names|should not use ALL_CAPS in Go names" + - path: (prog/.*) + text: "methods on the same type should have the same receiver name" + - path: (dashboard/app/.*_test\.go) + linters: - dupl - - path: (prog/.*_test\.go) - linters: + - path: (prog/.*_test\.go) + linters: - goconst - - path: (.*_test\.go) - text: "Function '.*' is too long" + - path: (.*_test\.go) + text: "Function '.*' is too long" + - path: tools/syz-trace2syz + linters: + - unused + - syz-linter + - godot + - path: sys/register.go + linters: + - whitespace # TODO: fix the code generation + - path: (.*_test.go) + linters: + - goconst + +issues: + max-same-issues: 0 |
