summaryrefslogtreecommitdiff
path: root/.golangci.yml
blob: 866c5a44e0663b5677b6e95afb4b3a7593f301b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Copyright (C) 2022-2023  Luke Shumaker <lukeshu@lukeshu.com>
#
# SPDX-License-Identifier: GPL-2.0-or-later

linters:
  enable-all: true
  disable:
    # Deprecated
    - deadcode         # deprecated, replaced by 'unused'
    - exhaustivestruct # deprecated, replaced by 'exhauststruct'
    - golint           # deprecated, replaced by 'revive'
    - ifshort          # deprecated
    - interfacer       # deprecated
    - maligned         # deprecated, replaced by 'govet fieldalignement'
    - nosnakecase      # deprecated, replaced by 'revive var-naming'
    - scopelint        # deprecated, replaced by 'exportloopref'
    - structcheck      # deprecated, replaced by 'unused'
    - varcheck         # deprecated, replaced by 'unused'

    # Don't support Go 1.18 generics yet
    - rowserrcheck
    - sqlclosecheck
    - wastedassign

    # Style
    - nlreturn
    - nonamedreturns # I name returns for godoc purposes.
    - tagliatelle
    - wsl
    - whitespace

    # Complexity; sometimes code is just complex.
    - cyclop
    - funlen
    - gocognit
    - gocyclo
    - maintidx
    - nestif

    # Miscellaneous
    - asciicheck # it's fine to include Unicode
    - godox # there are a few known TODOs, and that's OK
    - goerr113  # forbids fmt.Errorf(%w), which is just silly

    # These are disabled not because I think they're bad, but because
    # they currently don't pass, and I haven't really evaluated them
    # yet.
    - errorlint
    - exhaustive
    - exhaustruct
    - forcetypeassert
    - gochecknoglobals
    - gochecknoinits
    - gomnd
    - ireturn
    - lll
    - revive
    - testpackage
    - thelper
    - varnamelen
    - wrapcheck
linters-settings:
  gci:
    sections:
      - standard
      - default
      - prefix(git.lukeshu.com/go/lowmemjson)
  gofmt:
    simplify: true
  gosec:
    excludes:
      - G104 # duplicates errcheck
  nolintlint:
    require-explanation: true
    require-specific: true
issues:
  exclude-use-default: false
  exclude-rules:
    - path: "borrowed_.*_test\\.go"
      linters:
        - errcheck
        - godot
        - gofumpt
        - gosec
        - noctx
        - stylecheck
    - path: "borrowed_.*_test\\.go"
      linters: [gocritic]
      text: "commentFormatting: put a space between `//` and comment text"
    - path: "internal/"
      linters: [stylecheck]
      text: "ST1000" # package doc comment
  max-issues-per-linter: 0
  max-same-issues: 0