github.com/chenfeining/golangci-lint@v1.0.2-0.20230730162517-14c6c67868df/.golangci.yml (about)

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