github.com/vanstinator/golangci-lint@v0.0.0-20240223191551-cc572f00d9d1/.golangci.yml (about)

     1  linters-settings:
     2    depguard:
     3      # new configuration
     4      rules:
     5        logger:
     6          deny:
     7            # logging is allowed only by logutils.Log,
     8            # logrus is allowed to use only in logutils package.
     9            - pkg: "github.com/sirupsen/logrus"
    10              desc: logging is allowed only by logutils.Log
    11    dupl:
    12      threshold: 100
    13    funlen:
    14      lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner.
    15      statements: 50
    16    goconst:
    17      min-len: 2
    18      min-occurrences: 3
    19    gocritic:
    20      enabled-tags:
    21        - diagnostic
    22        - experimental
    23        - opinionated
    24        - performance
    25        - style
    26      disabled-checks:
    27        - dupImport # https://github.com/go-critic/go-critic/issues/845
    28        - ifElseChain
    29        - octalLiteral
    30        - whyNoLint
    31    gocyclo:
    32      min-complexity: 15
    33    gofmt:
    34      rewrite-rules:
    35        - pattern: 'interface{}'
    36          replacement: 'any'
    37    goimports:
    38      local-prefixes: github.com/vanstinator/golangci-lint
    39    gomnd:
    40      # don't include the "operation" and "assign"
    41      checks:
    42        - argument
    43        - case
    44        - condition
    45        - return
    46      ignored-numbers:
    47        - '0'
    48        - '1'
    49        - '2'
    50        - '3'
    51      ignored-functions:
    52        - strings.SplitN
    53  
    54    govet:
    55      check-shadowing: true
    56      settings:
    57        printf:
    58          funcs:
    59            - (github.com/vanstinator/golangci-lint/pkg/logutils.Log).Infof
    60            - (github.com/vanstinator/golangci-lint/pkg/logutils.Log).Warnf
    61            - (github.com/vanstinator/golangci-lint/pkg/logutils.Log).Errorf
    62            - (github.com/vanstinator/golangci-lint/pkg/logutils.Log).Fatalf
    63    errorlint:
    64      asserts: false
    65    lll:
    66      line-length: 140
    67    misspell:
    68      locale: US
    69    nolintlint:
    70      allow-unused: false # report any unused nolint directives
    71      require-explanation: false # don't require an explanation for nolint directives
    72      require-specific: false # don't require nolint directives to be specific about which linter is being skipped
    73    revive:
    74      rules:
    75        - name: unexported-return
    76          disabled: true
    77        - name: unused-parameter
    78  
    79  linters:
    80    disable-all: true
    81    enable:
    82      - bodyclose
    83      - depguard
    84      - dogsled
    85      - dupl
    86      - errcheck
    87      - errorlint
    88      - exportloopref
    89      - funlen
    90      - gocheckcompilerdirectives
    91      - gochecknoinits
    92      - goconst
    93      - gocritic
    94      - gocyclo
    95      - gofmt
    96      - goimports
    97      - gomnd
    98      - goprintffuncname
    99      - gosec
   100      - gosimple
   101      - govet
   102      - ineffassign
   103      - lll
   104      - misspell
   105      - nakedret
   106      - noctx
   107      - nolintlint
   108      - revive
   109      - staticcheck
   110      - stylecheck
   111      - typecheck
   112      - unconvert
   113      - unparam
   114      - unused
   115      - whitespace
   116  
   117    # don't enable:
   118    # - asciicheck
   119    # - scopelint
   120    # - gochecknoglobals
   121    # - gocognit
   122    # - godot
   123    # - godox
   124    # - goerr113
   125    # - interfacer
   126    # - maligned
   127    # - nestif
   128    # - prealloc
   129    # - testpackage
   130    # - wsl
   131  
   132  issues:
   133    # Excluding configuration per-path, per-linter, per-text and per-source
   134    exclude-rules:
   135      - path: _test\.go
   136        linters:
   137          - gomnd
   138  
   139      - path: pkg/golinters/errcheck.go
   140        text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead"
   141      - path: pkg/commands/run.go
   142        text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead"
   143      - path: pkg/commands/run.go
   144        text: "SA1019: e.cfg.Run.Deadline is deprecated: Deadline exists for historical compatibility and should not be used."
   145  
   146      - path: pkg/golinters/gofumpt.go
   147        text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead."
   148      - path: pkg/golinters/staticcheck_common.go
   149        text: "SA1019: settings.GoVersion is deprecated: use the global `run.go` instead."
   150      - path: pkg/lint/lintersdb/manager.go
   151        text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead."
   152      - path: pkg/golinters/unused.go
   153        text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)"
   154      - path: test/(fix|linters)_test.go
   155        text: "string `gocritic.go` has 3 occurrences, make it a constant"
   156  
   157      # Due to a change inside go-critic v0.10.0, some reports have been removed,
   158      # but as we run analysis with the previous version of golangci-lint this leads to a paradoxical situation.
   159      # This exclusion will be removed when the next version of golangci-lint (v1.56.0) will be released.
   160      - path: pkg/golinters/nolintlint/nolintlint.go
   161        text: "hugeParam: (i|b) is heavy \\(\\d+ bytes\\); consider passing it by pointer"
   162  
   163  run:
   164    timeout: 5m
   165    skip-dirs:
   166      - test/testdata_etc # test files
   167      - internal/cache # extracted from Go code
   168      - internal/renameio # extracted from Go code
   169      - internal/robustio # extracted from Go code