|
| 1 | +version: "2" |
| 2 | +run: |
| 3 | + go: "1.24" |
1 | 4 | linters: |
2 | 5 | enable: |
3 | | - - gofumpt |
4 | | - - thelper |
5 | | - - goimports |
6 | | - - tparallel |
7 | | - - wastedassign |
8 | | - - unparam |
9 | | - - prealloc |
10 | | - - unconvert |
| 6 | + - copyloopvar |
| 7 | + - errorlint |
11 | 8 | - exhaustive |
| 9 | + - intrange |
12 | 10 | - makezero |
13 | 11 | - nakedret |
14 | | - - copyloopvar |
15 | | - fast: false |
16 | | - |
17 | | -linters-settings: |
18 | | - copyloopvar: |
19 | | - # Check all assigning the loop variable to another variable. |
20 | | - # Default: false |
21 | | - # If true, an assignment like `a := x` will be detected as an error. |
22 | | - check-alias: true |
23 | | - exhaustive: |
24 | | - default-signifies-exhaustive: true |
25 | | - staticcheck: |
26 | | - # SA1019 is for checking that we're not using fields marked as deprecated |
27 | | - # in a comment. It decides this in a loose way so I'm silencing it. Also because |
28 | | - # it's tripping on our own structs. |
29 | | - checks: ["all", "-SA1019"] |
30 | | - nakedret: |
31 | | - # the gods will judge me but I just don't like naked returns at all |
32 | | - max-func-lines: 0 |
| 12 | + - nolintlint |
| 13 | + - prealloc |
| 14 | + - revive |
| 15 | + - thelper |
| 16 | + - tparallel |
| 17 | + - unconvert |
| 18 | + - unparam |
| 19 | + - wastedassign |
| 20 | + settings: |
| 21 | + copyloopvar: |
| 22 | + check-alias: true |
| 23 | + exhaustive: |
| 24 | + default-signifies-exhaustive: true |
| 25 | + nakedret: |
| 26 | + # the gods will judge me but I just don't like naked returns at all |
| 27 | + max-func-lines: 0 |
| 28 | + staticcheck: |
| 29 | + checks: |
| 30 | + - all |
33 | 31 |
|
34 | | -run: |
35 | | - go: "1.24" |
36 | | - timeout: 10m |
| 32 | + # SA1019 is for checking that we're not using fields marked as |
| 33 | + # deprecated in a comment. It decides this in a loose way so I'm |
| 34 | + # silencing it. Also because it's tripping on our own structs. |
| 35 | + - -SA1019 |
| 36 | + |
| 37 | + # ST1003 complains about names like remoteUrl or itemId (should be |
| 38 | + # remoteURL and itemID). While I like these suggestions, it also |
| 39 | + # complains about enum constants that are all caps, and we use these and |
| 40 | + # I like them, and also about camelCase identifiers that contain an |
| 41 | + # underscore, which we also use in a few places. Since it can't be |
| 42 | + # configured to ignore specific cases, and I don't want to use nolint |
| 43 | + # comments in the code, we have to disable it altogether. |
| 44 | + - -ST1003 # Poorly chosen identifier |
| 45 | + |
| 46 | + # Probably a good idea, but we first have to review our error reporting |
| 47 | + # strategy to be able to use it everywhere. |
| 48 | + - -ST1005 # Error strings should not be capitalized |
| 49 | + |
| 50 | + # Many of our classes use self as a receiver name, and we think that's fine. |
| 51 | + - -ST1006 # Use of self or this as receiver name |
| 52 | + |
| 53 | + # De Morgan's law suggests to replace `!(a && b)` with `!a || !b`; but |
| 54 | + # sometimes I find one more readable than the other, so I want to decide |
| 55 | + # that myself. |
| 56 | + - -QF1001 # De Morgan's law |
| 57 | + |
| 58 | + # QF1003 is about using a tagged switch instead of an if-else chain. In |
| 59 | + # many cases this is a useful suggestion; however, sometimes the change |
| 60 | + # is only possible by adding a default case to the switch (when there |
| 61 | + # was no `else` block in the original code), in which case I don't find |
| 62 | + # it to be an improvement. |
| 63 | + - -QF1003 # Could replace with tagged switch |
| 64 | + |
| 65 | + # We need to review our use of embedded fields. I suspect that in some |
| 66 | + # cases the fix is not to remove the selector for the embedded field, |
| 67 | + # but to turn the embedded field into a named field. |
| 68 | + - -QF1008 # Could remove embedded field from selector |
| 69 | + |
| 70 | + # The following checks are all disabled by default in golangci-lint, but |
| 71 | + # we disable them again explicitly here to make it easier to keep this |
| 72 | + # list in sync with the gopls config in .vscode/settings.json. |
| 73 | + - -ST1000, # At least one file in a package should have a package comment |
| 74 | + - -ST1020, # The documentation of an exported function should start with the function's name |
| 75 | + - -ST1021, # The documentation of an exported type should start with type's name |
| 76 | + - -ST1022, # The documentation of an exported variable or constant should start with variable's name |
| 77 | + |
| 78 | + dot-import-whitelist: |
| 79 | + - github.com/jesseduffield/lazygit/pkg/integration/components |
| 80 | + revive: |
| 81 | + severity: warning |
| 82 | + rules: |
| 83 | + - name: atomic |
| 84 | + - name: context-as-argument |
| 85 | + - name: context-keys-type |
| 86 | + - name: error-naming |
| 87 | + - name: var-declaration |
| 88 | + - name: package-comments |
| 89 | + - name: range |
| 90 | + - name: time-naming |
| 91 | + - name: indent-error-flow |
| 92 | + - name: errorf |
| 93 | + - name: superfluous-else |
| 94 | + exclusions: |
| 95 | + generated: lax |
| 96 | + presets: |
| 97 | + - comments |
| 98 | + - common-false-positives |
| 99 | + - legacy |
| 100 | + - std-error-handling |
| 101 | + paths: |
| 102 | + - third_party$ |
| 103 | + - builtin$ |
| 104 | + - examples$ |
| 105 | +formatters: |
| 106 | + enable: |
| 107 | + - gofumpt |
| 108 | + - goimports |
| 109 | + exclusions: |
| 110 | + generated: lax |
| 111 | + paths: |
| 112 | + - third_party$ |
| 113 | + - builtin$ |
| 114 | + - examples$ |
0 commit comments