2025-12-08 15:06:05 +00:00
|
|
|
# This configuration is for incremental linting of new/experimental linters.
|
|
|
|
|
# It is used with --new-from-rev to only lint changed code.
|
|
|
|
|
# See .golangci.yml for the main linter configuration.
|
|
|
|
|
version: "2"
|
|
|
|
|
|
|
|
|
|
issues:
|
|
|
|
|
max-issues-per-linter: 0 # show all issues
|
|
|
|
|
max-same-issues: 0 # show all issues
|
|
|
|
|
|
|
|
|
|
linters:
|
|
|
|
|
default: none
|
|
|
|
|
enable:
|
2026-03-19 16:19:42 +00:00
|
|
|
- gosec
|
2025-12-08 15:06:05 +00:00
|
|
|
- modernize
|
2026-03-30 17:39:12 +00:00
|
|
|
- testifylint
|
2026-02-06 14:51:17 +00:00
|
|
|
- nilaway
|
2026-03-31 21:26:24 +00:00
|
|
|
- setboolcheck
|
2026-04-02 18:20:43 +00:00
|
|
|
- depguard
|
2026-02-06 14:51:17 +00:00
|
|
|
settings:
|
2026-03-19 16:19:42 +00:00
|
|
|
gosec:
|
|
|
|
|
# Only enable rules that are too noisy on existing code but valuable for new code.
|
|
|
|
|
# Existing violations were audited during the v2.7.1 -> v2.11.3 upgrade and found
|
|
|
|
|
# to be false positives or safe patterns, but we want to catch real issues going forward.
|
|
|
|
|
includes:
|
|
|
|
|
- G101 # Potential hardcoded credentials.
|
|
|
|
|
- G115 # Integer overflow conversion.
|
|
|
|
|
- G117 # Marshaled struct field matches secret pattern.
|
|
|
|
|
- G118 # Goroutine uses context.Background/TODO while request-scoped context is available.
|
|
|
|
|
- G122 # Filesystem race in filepath.Walk/WalkDir callback.
|
|
|
|
|
- G202 # SQL string concatenation.
|
|
|
|
|
- G602 # Slice index out of range.
|
|
|
|
|
- G704 # SSRF via taint analysis.
|
|
|
|
|
- G705 # XSS via taint analysis.
|
|
|
|
|
- G706 # Log injection via taint analysis.
|
2026-04-02 18:20:43 +00:00
|
|
|
depguard:
|
|
|
|
|
rules:
|
|
|
|
|
no-old-rand:
|
|
|
|
|
list-mode: lax
|
|
|
|
|
deny:
|
|
|
|
|
- pkg: math/rand$
|
|
|
|
|
desc: Use math/rand/v2 instead
|
2026-02-06 14:51:17 +00:00
|
|
|
custom:
|
|
|
|
|
nilaway:
|
|
|
|
|
type: module
|
|
|
|
|
description: Static analysis tool to detect potential nil panics in Go code.
|
|
|
|
|
settings:
|
|
|
|
|
# Settings must be a "map from string to string" to mimic command line flags: the keys are
|
|
|
|
|
# flag names and the values are the values to the particular flags.
|
|
|
|
|
include-pkgs: "github.com/fleetdm/fleet/v4"
|
2026-03-31 21:26:24 +00:00
|
|
|
setboolcheck:
|
|
|
|
|
type: module
|
|
|
|
|
description: Flags map[T]bool used as sets; suggests map[T]struct{} instead.
|
2026-02-06 14:51:17 +00:00
|
|
|
exclusions:
|
|
|
|
|
generated: strict
|
Filter bogus nilaway internal error (#39554)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #32999
Intended to get rid of these crash messages seen in CI:
```
Error: level=warning msg="[runner] Can't process results by generated_file_filter processor: can't filter issue &result.Issue{FromLinter:\"nilaway\", Text:\"\\x1b[31merror: \\x1b[0mINTERNAL ERROR(s):\\nnilaway_assertion_analyzer: nilaway_function_analyzer: skipping function \\x1b[95m`ListHostSoftware()`\\x1b[0m at /home/runner/work/fleet/fleet/server/datastore/mysql/software.go:4217:1: function too large (623 CFG blocks, exceeds limit of 500 blocks)\", Severity:\"\", SourceLines:[]string(nil), Pkg:(*packages.Package)(0xc002fe64e0), Pos:token.Position{Filename:\"/home/runner/work/fleet/fleet/$GOROOT/src/unicode/utf16/utf16.go\", Offset:0, Line:1, Column:1}, LineRange:(*result.Range)(nil), HunkPos:0, SuggestedFixes:[]analysis.SuggestedFix(nil), ExpectNoLint:false, ExpectedNoLintLinter:\"\", WorkingDirectoryRelativePath:\"$GOROOT/src/unicode/utf16/utf16.go\", RelativePath:\"$GOROOT/src/unicode/utf16/utf16.go\"}: failed to get doc (strict) of file /home/runner/work/fleet/fleet/$GOROOT/src/unicode/utf16/utf16.go: failed to parse file: open /home/runner/work/fleet/fleet/$GOROOT/src/unicode/utf16/utf16.go: no such file or directory"
```
2026-02-10 01:59:58 +00:00
|
|
|
rules:
|
|
|
|
|
# nilaway has a hardcoded 500 CFG block limit (_maxFuncSizeInCFGBlocks). Functions exceeding
|
|
|
|
|
# it produce an INTERNAL ERROR with a bogus $GOROOT path that crashes golangci-lint's
|
|
|
|
|
# generated_file_filter processor. These are informational skip messages, not real findings.
|
|
|
|
|
- linters:
|
|
|
|
|
- nilaway
|
|
|
|
|
text: "INTERNAL ERROR"
|