github.com/elek/golangci-lint@v1.42.2-0.20211208090441-c05b7fcb3a9a/pkg/commands/default.yaml (about)

     1  run:
     2    deadline: 10m
     3    issues-exit-code: 1
     4    tests: true
     5  
     6    skip-files:
     7      - ".*\\.pb\\.go$"
     8      - ".*\\.dbx\\.go$"
     9  
    10  
    11  linters:
    12    enable:
    13      - bodyclose               # find unclosed http response bodies
    14      - deadcode                # find code that is not used
    15      - dogsled                 # checks for too many ignored arguments
    16      - durationcheck           # verifies whether durations are multiplied, usually a mistake
    17      - errcheck                # find unchecked errors
    18      - errorlint               # finds misuses of errors
    19      - exportloopref           # check for exported loop vars
    20      - gocritic                # checks for style, performance issues, and common programming errors
    21      - godot                   # dots for everything
    22      - goerr113                # check error expressions
    23      - gofmt                   # sanity check formatting
    24      - goprintffuncname        # checks that printf-like functions are named with `f` at the end [fast: true, auto-fix: false]
    25      - govet                   # check standard vet rules
    26      - importas                # verify that imports are consistent
    27      - ineffassign             # find ineffective assignments
    28      - makezero                # verifies that slices use defaults
    29      - misspell                # check spelling
    30      - nakedret                # check for naked returns
    31      - nilerr                  # checks for misuses of `if err != nil { return nil }`
    32      - noctx                   # finds locations that should use context
    33      - nolintlint              # checks that nolint directives are correct
    34      - revive                  # check standard linting rules
    35      - staticcheck             # comprehensive checks
    36      - structcheck             # check for unused struct parameters
    37      - unconvert               # remove unnecessary conversions
    38      - varcheck                # find unused global variables and constants
    39      - wastedassign
    40      - errs
    41      - deferloop
    42      - monkit
    43      #TODO#- forcetypeassert   # needs work to replace unchecked interface type assertion
    44      #TODO#- gochecknoglobals  # needs work to remove globals
    45      #TODO#- gochecknoinits    # needs work to remove init()
    46      #TODO#- gofumpt           # not sure whether it's useful
    47      #TODO#- nestif            # looks useful, however needs work
    48      #TODO#- prealloc          # easy optimizations
    49      #TODO#- unparam           # check for unused parameters
    50      #TODO#- whitespace        # checks for leading/trailing newlines
    51    disable:
    52      - asciicheck       # non-ascii is allowed
    53      - cyclop           # this complexity is not a good metric
    54      - depguard         # unused
    55      - dupl             # slow
    56      - exhaustive       # doesn't handle default case
    57      - exhaustivestruct # false positivies
    58      - forbidigo        # not useful
    59      - funlen           # no limit on func length
    60      - gci              # we have custom import checking
    61      - gocognit         # this complexity is not a good metric
    62      - goconst          # check for things that could be replaced by constants
    63      - gocyclo          # this complexity is not a good metric
    64      - godox            # too many false positivies
    65      - goheader         # separate tool
    66      - goimports        # disabled, because it's slow, using scripts/check-imports.go instead.
    67      - gomnd            # false positives
    68      - gomoddirectives  # not useful
    69      - gomodguard       # not useful
    70      - gosec            # needs tweaking
    71      - gosimple         # part of staticcheck
    72      - ifshort          # usefulness, depends on the context
    73      - interfacer       # not that useful
    74      - lll              # don't need this check
    75      - nlreturn         # non-important code style
    76      - paralleltest     # too many false positives
    77      - predeclared      # kind of useful, but not critical
    78      - promlinter       # not relevant
    79      - rowserrcheck     # checks if sql.Rows.Err is checked correctly - Disabled  because it reports false positive with defer statements after Query call
    80      - sqlclosecheck    # we have tagsql, which checks this better
    81      - stylecheck       # has false positives
    82      - tagliatelle      # not our style
    83      - testpackage      # sometimes it's useful to have tests on private funcs
    84      - thelper          # too many false positives
    85      - tparallel        # false positivies
    86      - unused           # part of staticcheck
    87      - wrapcheck        # too much noise and false positives
    88      - wsl              # too much noise
    89    fast: false
    90  
    91  output:
    92    format: colored-line-number
    93    print-issued-lines: true
    94    print-linter-name: true
    95  
    96  linters-settings:
    97    errcheck:
    98      # report about not checking of errors in type assetions: `a := b.(MyStruct)`;
    99      # default is false: such cases aren't reported by default.
   100      check-type-assertions: false
   101  
   102      # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
   103      # default is false: such cases aren't reported by default.
   104      check-blank: false
   105    govet:
   106      # report about shadowed variables
   107      #TODO# check-shadowing: true
   108  
   109      # Obtain type information from installed (to $GOPATH/pkg) package files:
   110      # golangci-lint will execute `go install -i` and `go test -i` for analyzed packages
   111      # before analyzing them.
   112      # Enable this option only if all conditions are met:
   113      #  1. you use only "fast" linters (--fast e.g.): no program loading occurs
   114      #  2. you use go >= 1.10
   115      #  3. you do repeated runs (false for CI) or cache $GOPATH/pkg or `go env GOCACHE` dir in CI.
   116      use-installed-packages: false
   117    gocritic:
   118      disabled-checks:
   119        - ifElseChain
   120    goimports:
   121      local: "storj.io"
   122    golint:
   123      min-confidence: 0.8
   124    gofmt:
   125      simplify: true
   126    gocyclo:
   127      min-complexity: 10
   128    dupl:
   129      threshold: 150
   130    goconst:
   131      min-len: 3
   132      min-occurrences: 3
   133    misspell:
   134    lll:
   135      line-length: 140
   136      tab-width: 1
   137    unused:
   138      # treat code as a program (not a library) and report unused exported identifiers; default is false.
   139      # XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
   140      # if it's called for subdir of a project it can't find funcs usages. All text editor integrations
   141      # with golangci-lint call it on a directory with the changed file.
   142      check-exported: false
   143    unparam:
   144      # call graph construction algorithm (cha, rta). In general, use cha for libraries,
   145      # and rta for programs with main packages. Default is cha.
   146      algo: cha
   147  
   148      # Inspect exported functions, default is false. Set to true if no external program/library imports your code.
   149      # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
   150      # if it's called for subdir of a project it can't find external interfaces. All text editor integrations
   151      # with golangci-lint call it on a directory with the changed file.
   152      check-exported: false
   153    nakedret:
   154      # make an issue if func has more lines of code than this setting and it has naked returns; default is 30
   155      max-func-lines: 30
   156    prealloc:
   157      # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
   158      # True by default.
   159      simple: true
   160      range-loops: true # Report preallocation suggestions on range loops, true by default
   161      for-loops: false # Report preallocation suggestions on for loops, false by default
   162  
   163  issues:
   164    max-issues-per-linter: 0
   165    max-same-issues: 0
   166    new: false
   167    exclude-use-default: false
   168  
   169    exclude-rules:
   170      - linters:
   171          - goerr113
   172        text: "do not define dynamic errors"
   173      - linters:
   174          - revive
   175        text: "if-return"