linters-settings: errcheck: # report about not checking of errors in type assetions: `a := b.(MyStruct)`; # default is false: such cases aren't reported by default. check-type-assertions: true # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; # default is false: such cases aren't reported by default. check-blank: true exhaustive: # Presence of "default" case in switch statements satisfies exhaustiveness, # even if all enum members are not listed. default-signifies-exhaustive: true funlen: lines: 100 statements: 50 gocyclo: min-complexity: 45 gocognit: min-complexity: 45 dupl: threshold: 150 goconst: min-len: 3 min-occurrences: 5 govet: enable-all: true disable: - fieldalignment lll: line-length: 180 tab-width: 1 cyclop: # the maximal code complexity to report max-complexity: 45 # the maximal average package complexity. If it's higher than 0.0 (float) the check is enabled (default 0.0) package-average: 0.0 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: # 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: # if it's called for subdir of a project it can't find external interfaces. All text editor integrations # with golangci-lint call it on a directory with the changed file. check-exported: false nakedret: # make an issue if func has more lines of code than this setting and it has naked returns; default is 30 max-func-lines: 5 prealloc: # XXX: we don't recommend using this linter before doing performance profiling. # For most programs usage of prealloc will be a premature optimization. # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them. # True by default. simple: true range-loops: true # Report preallocation suggestions on range loops, true by default for-loops: true # Report preallocation suggestions on for loops, false by default gocritic: enabled-tags: - diagnostic - experimental - opinionated - performance - style disabled-checks: - dupImport # https://github.com/go-critic/go-critic/issues/845 - octalLiteral - unnamedResult # Settings passed to gocritic. # The settings key is the name of a supported gocritic checker. # The list of supported checkers can be find in https://go-critic.github.io/overview. settings: hugeParam: # Size in bytes that makes the warning trigger. # Default: 80 sizeThreshold: 121 dogsled: # checks assignments with too many blank identifiers; default is 2 max-blank-identifiers: 2 whitespace: multi-if: false # Enforces newlines (or comments) after every multi-line if statement multi-func: false # Enforces newlines (or comments) after every multi-line function signature gomoddirectives: # List of allowed `replace` directives. Default is empty. # Add your allowed `replace` targets here, this rule is so you don't accidentally commit replacements you added for testing replace-allow-list: [] nolintlint: allow-leading-space: false # require machine-readable nolint directives (i.e. with no leading space) allow-unused: false # report any unused nolint directives require-explanation: true # require an explanation for nolint directives require-specific: true # require nolint directives to be specific about which linter is being skipped nlreturn: # Size of the block (including return statement that is still "OK") # so no return split required. block-size: 5 stylecheck: initialisms: ["ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS", "SIP", "RTP", "AMQP", "DB", "TS"] revive: rules: - name: context-keys-type disabled: false - name: time-naming disabled: false - name: var-declaration disabled: false - name: unexported-return disabled: false - name: errorf disabled: false - name: blank-imports disabled: false - name: context-as-argument disabled: false - name: dot-imports disabled: false - name: error-return disabled: false - name: error-strings disabled: false - name: error-naming disabled: false - name: exported disabled: false - name: increment-decrement disabled: false - name: var-naming disabled: true - name: package-comments disabled: false - name: range disabled: false - name: receiver-naming disabled: false - name: indent-error-flow disabled: false nestif: min-complexity: 10 linters: # please, do not use `enable-all`: it's deprecated and will be removed soon. # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint disable-all: true enable: - dogsled - dupl - copyloopvar - exhaustive - gochecknoinits - goconst - gocritic - gocyclo - goprintffuncname - gosec - govet - ineffassign - lll - gosimple - misspell - nakedret - nolintlint - revive - staticcheck - typecheck - unconvert - unused - gochecknoglobals - prealloc - asciicheck - nestif - bodyclose - cyclop - durationcheck - errcheck - errorlint - forbidigo - forcetypeassert - gocognit - gomoddirectives - gomodguard - importas - makezero - nilerr - noctx - predeclared - promlinter - rowserrcheck - sqlclosecheck - tparallel - unparam - wastedassign issues: # Excluding configuration per-path, per-linter, per-text and per-source exclude-rules: - path: audit/api/api_common.go text: 'context-as-argument' - path: audit/api/api.go|log/log.go|audit/api/model.go|telemetry/telemetry.go linters: - gochecknoglobals - path: audit/api/api_.*.go linters: - dupl - path: audit/api/model.go text: 'exported: type name will be used as api.ApiRequest by other packages' - path: audit/api/model_test.go|audit/api/model.go text: 'G115' - path: audit/api/test_data.go linters: - gosec - path: _test\.go linters: - gochecknoglobals - noctx - forcetypeassert - dogsled - goconst - unparam - dupl - errcheck - forbidigo - lll - gocritic - nestif - revive - gocognit - unconvert - unparam - wsl - gosimple - ineffassign - nakedret - nlreturn - staticcheck - wastedassign - text: 'declaration of "err" shadows declaration' linters: - govet - path: test_.*\.go|audit/messaging/solace.go linters: - gochecknoglobals - noctx - forcetypeassert - dogsled - goconst - unparam - dupl - errcheck - forbidigo - lll - gocritic - nestif - revive - gocognit - unconvert - unparam - wsl - gosimple - ineffassign - nakedret - nlreturn - staticcheck - wastedassign max-same-issues: 0 max-issues-per-linter: 0 run: timeout: 10m issues-exit-code: 1 tests: true