diff --git a/.custom-gcl.yml b/.custom-gcl.yml new file mode 100644 index 00000000..a58014e7 --- /dev/null +++ b/.custom-gcl.yml @@ -0,0 +1,6 @@ +# This has to be >= v1.57.0 for module plugin system support. +version: v2.4.0 +plugins: + - module: "go.uber.org/nilaway" + import: "go.uber.org/nilaway/cmd/gclplugin" + version: latest # Or a fixed version for reproducible builds. \ No newline at end of file diff --git a/.golangci.yml b/.golangci.yml index dd8a0794..e1718765 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,10 +1,18 @@ -version: "2" +version: '2' linters: enable: - forbidigo - misspell - whitespace - gochecknoinits + # Static analysis tool to detect potential nil panics in Go code. + - nilaway + # Checks function and package cyclomatic complexity. + - cyclop + # Check whether the function uses a non-inherited context. + - contextcheck + - gosec + - promlinter settings: forbidigo: forbid: @@ -12,6 +20,12 @@ linters: msg: Do not commit print statements. Use logger package. - pattern: ^log\.(Fatal|Panic|Print)(f|ln)?.*$ msg: Do not commit log statements. Use logger package. + custom: + nilaway: + type: module + description: 'Static analysis tool to detect potential nil panics in Go code.' + settings: + exclude-pkgs: vendor exclusions: generated: lax presets: @@ -33,6 +47,22 @@ linters: - third_party$ - builtin$ - examples$ +severity: + default: error + rules: + - linters: + - cyclop + severity: warning + - linters: + - contextcheck + severity: warning + - linters: + - gosec + severity: warning + - linters: + - gosec + severity: warning + formatters: enable: - goimports