fix golangci lint file

Signed-off-by: Aditya Menon <amenon@canarytechnologies.com>
This commit is contained in:
Aditya Menon 2025-02-17 16:13:37 +01:00
parent 301bcafed5
commit d5f4f14879
No known key found for this signature in database
2 changed files with 41 additions and 29 deletions

View File

@ -27,10 +27,6 @@ run:
# - src/external_libs # - src/external_libs
# - autogenerated_by_my_lib # - autogenerated_by_my_lib
# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true
# 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
# no need to include all autogenerated files, we confidently recognize # no need to include all autogenerated files, we confidently recognize
@ -51,8 +47,35 @@ run:
# output configuration options # output configuration options
output: output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" # The formats used to render issues.
format: line-number # Formats:
# - `colored-line-number`
# - `line-number`
# - `json`
# - `colored-tab`
# - `tab`
# - `html`
# - `checkstyle`
# - `code-climate`
# - `junit-xml`
# - `junit-xml-extended`
# - `github-actions`
# - `teamcity`
# - `sarif`
# Output path can be either `stdout`, `stderr` or path to the file to write to.
#
# For the CLI flag (`--out-format`), multiple formats can be specified by separating them by comma.
# The output can be specified for each of them by separating format name and path by colon symbol.
# Example: "--out-format=checkstyle:report.xml,json:stdout,colored-line-number"
# The CLI flag (`--out-format`) override the configuration file.
#
# Default:
# formats:
# - format: colored-line-number
# path: stdout
formats:
- format: line-number
path: stdout
# print lines of code with issue, default is true # print lines of code with issue, default is true
print-issued-lines: true print-issued-lines: true
@ -88,12 +111,13 @@ linters-settings:
# Disable error checking, as errorcheck detects more errors and is more configurable. # Disable error checking, as errorcheck detects more errors and is more configurable.
gosec: gosec:
exclude: excludes:
- "G104" - "G104"
govet: govet:
# report about shadowed variables # report about shadowed variables
check-shadowing: false disable:
- shadow
# settings per analyzer # settings per analyzer
settings: settings:
@ -111,13 +135,15 @@ linters-settings:
# disable: # disable:
# - shadow # - shadow
# disable-all: false # disable-all: false
golint: revive:
# minimal confidence for issues, default is 0.8 # minimal confidence for issues, default is 0.8
min-confidence: 0.8 confidence: 0.8
ignore-generated-header: true
severity: warning
gofmt: gofmt:
# simplify code: gofmt with `-s` option, true by default # simplify code: gofmt with `-s` option, true by default
simplify: true simplify: true
goimports: # goimports:
# put imports beginning with prefix after 3rd-party packages; # put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes # it's a comma-separated list of prefixes
# local-prefixes: github.com/org/project # local-prefixes: github.com/org/project
@ -127,9 +153,6 @@ linters-settings:
gocognit: gocognit:
# minimal code complexity to report, 30 by default (but we recommend 10-20) # minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 100 min-complexity: 100
maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true
dupl: dupl:
# tokens count to trigger issue, 150 by default # tokens count to trigger issue, 150 by default
threshold: 100 threshold: 100
@ -159,12 +182,6 @@ linters-settings:
line-length: 120 line-length: 120
# tab width in spaces. Default to 1. # tab width in spaces. Default to 1.
tab-width: 1 tab-width: 1
unused:
# treat code as a program (not a library) and report unused exported identifiers; default is false.
# XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
# if it's called for subdir of a project it can't find funcs usages. All text editor integrations
# with golangci-lint call it on a directory with the changed file.
check-exported: false
unparam: unparam:
# Inspect exported functions, default is false. Set to true if no external program/library imports your code. # Inspect exported functions, default is false. Set to true if no external program/library imports your code.
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors: # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
@ -173,7 +190,7 @@ linters-settings:
check-exported: false check-exported: false
nakedret: nakedret:
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30 # make an issue if func has more lines of code than this setting and it has naked returns; default is 30
max-func-lines: 50 max-func-lines: 50
prealloc: prealloc:
# XXX: we don't recommend using this linter before doing performance profiling. # XXX: we don't recommend using this linter before doing performance profiling.
# For most programs usage of prealloc will be a premature optimization. # For most programs usage of prealloc will be a premature optimization.
@ -237,9 +254,6 @@ linters-settings:
allow-trailing-comment: false allow-trailing-comment: false
# Force newlines in end of case at this limit (0 = never). # Force newlines in end of case at this limit (0 = never).
force-case-trailing-whitespace: 0 force-case-trailing-whitespace: 0
revive:
ignore-generated-header: true
severity: warning
funlen: funlen:
# Checks the number of lines in a function. # Checks the number of lines in a function.
# If lower than 0, disable the check. # If lower than 0, disable the check.
@ -270,7 +284,7 @@ linters:
- ineffassign - ineffassign
- misspell - misspell
- nakedret - nakedret
- exportloopref - copyloopvar
- staticcheck - staticcheck
- typecheck - typecheck
- unconvert - unconvert
@ -357,4 +371,4 @@ issues:
# new-from-rev: REV # new-from-rev: REV
# Show only new issues created in git patch with set file path. # Show only new issues created in git patch with set file path.
# new-from-patch: path/to/patch/file # new-from-patch: path/to/patch/file

View File

@ -1324,7 +1324,6 @@ func (a *App) getSelectedReleases(r *Run, includeTransitiveNeeds bool) ([]state.
selectedIds := map[string]state.ReleaseSpec{} selectedIds := map[string]state.ReleaseSpec{}
selectedCounts := map[string]int{} selectedCounts := map[string]int{}
for _, r := range selected { for _, r := range selected {
r := r
id := state.ReleaseToID(&r) id := state.ReleaseToID(&r)
selectedIds[id] = r selectedIds[id] = r
selectedCounts[id]++ selectedCounts[id]++
@ -1338,7 +1337,6 @@ func (a *App) getSelectedReleases(r *Run, includeTransitiveNeeds bool) ([]state.
groupsByID := map[string][]*state.ReleaseSpec{} groupsByID := map[string][]*state.ReleaseSpec{}
for _, r := range allReleases { for _, r := range allReleases {
r := r
groupsByID[state.ReleaseToID(&r)] = append(groupsByID[state.ReleaseToID(&r)], &r) groupsByID[state.ReleaseToID(&r)] = append(groupsByID[state.ReleaseToID(&r)], &r)
} }