syzkaller/.golangci.yml
Dmitry Vyukov c992206a1d tools/syz-linter: add custom linter
For now we have 2 simple checks:

1. for multiline comments:
/* */ -> //

2. for string len comparison with 0:
len(str) != 0 -> str != ""

Update #1876
2020-07-04 15:05:30 +02:00

121 lines
2.5 KiB
YAML

# 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.
run:
deadline: 8m
skip-dirs:
- pkg/kd
- tools/syz-trace2syz
# Autogenerated files take too much time and memory to load,
# even if we skip them with skip-dirs.
# So we define this tag and use it in the autogenerated files.
build-tags:
- codeanalysis
output:
print-linter-name: false
linters:
enable:
- lll
- vet
- gofmt
- golint
- structcheck
- unconvert
- deadcode
- goconst
- unused
- gosimple
- varcheck
- misspell
- gocyclo
- vetshadow
- megacheck
- stylecheck
- govet
- whitespace
- nestif
- goprintffuncname
- godot
- gocognit
- funlen
- dupl
- syz-linter
disable:
- bodyclose
- depguard
- dogsled
- gochecknoglobals
- gochecknoinits
- godox
- goimports
- gomnd
- gomodguard
- gosec
- maligned
- rowserrcheck
- testpackage
- typecheck
- ineffassign
# errcheck would be good to enable, but we need to fix existing warnings first.
- errcheck
- interfacer
- unparam
- nakedret
- prealloc
- scopelint
- gocritic
- wsl
linters-settings:
lll:
line-length: 120
gocyclo:
# TODO: consider reducing this value.
min-complexity: 24
dupl:
threshold: 60
goconst:
min-len: 3
min-occurrences: 3
nestif:
# TODO: consider reducing this value.
min-complexity: 12
godot:
check-all: true
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
issues:
exclude-use-default: false
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"
exclude-rules:
- 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:
- dupl
- path: (prog/.*_test\.go)
linters:
- goconst
- path: (.*_test\.go)
text: "Function '.*' is too long"