|
5 | 5 | concurrency: 2 |
6 | 6 | modules-download-mode: readonly |
7 | 7 |
|
| 8 | +output: |
| 9 | + # Satisfies "order the results by file" |
| 10 | + sort-order: |
| 11 | + - file |
| 12 | + - linter |
| 13 | + |
8 | 14 | linters: |
9 | | - # 1. Enable EVERY available linter |
10 | 15 | default: all |
11 | | - |
12 | | - # 2. Disable specific linters. |
13 | 16 | disable: |
14 | | - # --- DEPRECATED / REMOVED LINTERS --- |
15 | | - - noinlineerr # Disabled: We prefer the standard idiom 'if err := ...; err != nil' to reduce scope. |
16 | | - - wsl |
17 | | - |
18 | | - # --- LEVEL 1: CRITICAL BUGS & SECURITY --- |
19 | | - # - forcetypeassert |
20 | | - # - gosec |
21 | | - |
22 | | - # --- LEVEL 2: STYLE & MODERNIZATION --- |
23 | | - # - modernize |
24 | | - # - perfsprint |
25 | | - # - revive |
26 | | - # - unused |
27 | | - # - goconst |
28 | | - |
29 | | - # --- LEVEL 3: ERROR HANDLING & BEST PRACTICES --- |
30 | | - # - err113 |
31 | | - # - nilerr |
32 | | - # - nlreturn |
33 | | - # - staticcheck |
34 | | - # - errcheck # Unchecked errors |
35 | | - # - nonamedreturns # Named returns usage |
36 | | - |
37 | | - # --- LEVEL 4: COMPLEXITY & REFACTORING --- |
38 | | - # - cyclop |
39 | | - # - funlen |
40 | | - # - gocognit |
41 | | - # - maintidx |
42 | | - # - mnd |
43 | | - # - nestif |
44 | | - # - wrapcheck |
45 | | - |
46 | | - # --- LEVEL 5: STRICT STANDARDS & OPINIONS --- |
47 | | - # - depguard |
48 | | - # - exhaustruct |
49 | | - # - gochecknoglobals |
50 | | - # - godoclint |
51 | | - # - ireturn |
52 | | - # - lll |
53 | | - # - varnamelen |
54 | | - # - wsl_v5 |
55 | | - # - forbidigo # Forbidden identifiers (fmt.Print, etc) |
56 | | - # - funcorder # Function ordering |
57 | | - # - gochecknoinits # Init functions |
58 | | - # - godox # TODOs |
59 | | - # - goprintffuncname # Printf-like naming |
60 | | - # - tagliatelle # JSON struct tags |
61 | | - # - nolintlint |
| 17 | + # --- Style & Idiom (Too Opinionated) --- |
| 18 | + - wsl # Too strict; conflicts with logical grouping. |
62 | 19 |
|
63 | | - # --- TESTING --- |
64 | | - # - testifylint |
65 | | - # - usetesting |
66 | | - # - paralleltest # (Added to ensure tests run without forcing parallel) |
| 20 | + # --- Style Preference --- |
| 21 | + - noinlineerr # Disabled to allow idiomatic `if err :=...` |
| 22 | + - err113 |
| 23 | + - errcheck |
| 24 | + - exhaustruct |
| 25 | + - funlen |
| 26 | + - gochecknoinits |
| 27 | + - gocognit |
| 28 | + - gosec |
| 29 | + - lll |
| 30 | + - mnd |
| 31 | + - nestif |
| 32 | + - revive |
| 33 | + - varnamelen |
| 34 | + - cyclop |
| 35 | + - gochecknoglobals |
| 36 | + - unparam |
| 37 | + - wrapcheck |
| 38 | + - depguard |
67 | 39 |
|
68 | | - # --- NOISE / LOW VALUE --- |
69 | | - # - gocritic |
70 | | - # - thelper |
71 | | - # - unparam |
72 | | - # - exhaustive # Exhaustive switch statements |
| 40 | + exclusions: |
| 41 | + generated: strict |
| 42 | + warn-unused: true |
| 43 | + presets: |
| 44 | + # - comments |
| 45 | + # - std-error-handling |
| 46 | + # - common-false-positives |
| 47 | + # - legacy |
| 48 | + rules: |
| 49 | + - path: "cmd/version/version.go" |
| 50 | + linters: |
| 51 | + - gochecknoinits |
| 52 | + - exhaustruct |
| 53 | + - gochecknoglobals |
| 54 | + - errcheck |
73 | 55 |
|
74 | 56 | settings: |
75 | | - ireturn: |
76 | | - allow: |
77 | | - - error |
78 | | - - github.com/contextvibes/cli/internal/workitem.Provider |
79 | | - - github.com/contextvibes/cli/internal/exec.CommandExecutor |
| 57 | + gofumpt: |
| 58 | + extra-rules: true |
| 59 | + |
80 | 60 | depguard: |
81 | 61 | rules: |
| 62 | + # Rule 1: Production Code (Main) |
82 | 63 | main: |
83 | | - list-mode: lax |
| 64 | + list-mode: strict |
84 | 65 | files: |
85 | | - - "!**/*_a _file.go" |
| 66 | + - "$all" |
| 67 | + - "!$test" # Critical: Exclude test files from this strict rule |
86 | 68 | allow: |
87 | 69 | - $gostd |
88 | | - - github.com/OpenPeeDeeP |
| 70 | + # Allow SDKs |
| 71 | + - golang.org/x/oauth2 |
| 72 | + - github.com/spf13/cobra |
| 73 | + - google.golang.org/grpc |
| 74 | + - github.com/charmbracelet/huh |
| 75 | + - gopkg.in/yaml.v3 |
| 76 | + - github.com/denormal/go-gitignore |
| 77 | + - github.com/shurcooL/githubv4 |
| 78 | + - github.com/google/go-github/v74/github |
| 79 | + - github.com/fatih/color |
| 80 | + - github.com/mattn/go-isatty |
| 81 | + # Allow your project imports |
| 82 | + - github.com/contextvibes/cli |
| 83 | + - github.com/mark3labs/mcp-go/mcp |
89 | 84 | deny: |
90 | 85 | - pkg: "math/rand$" |
91 | | - desc: use math/rand/v2 |
92 | | - - pkg: "github.com/sirupsen/logrus" |
93 | | - desc: not allowed |
| 86 | + desc: "Use math/rand/v2 for safer, faster generation (Go 1.22+)" |
94 | 87 | - pkg: "github.com/pkg/errors" |
95 | | - desc: Should be replaced by standard lib errors package |
| 88 | + desc: "Use stdlib errors.New, fmt.Errorf, and errors.Is/As" |
| 89 | + - pkg: "github.com/sirupsen/logrus" |
| 90 | + desc: "Use log/slog (stdlib) or uber-go/zap" |
| 91 | + |
| 92 | + ireturn: |
| 93 | + allow: |
| 94 | + - anon |
| 95 | + - error |
| 96 | + - empty |
| 97 | + - stdlib |
| 98 | + # --- Architecture Exemptions (Dependency Injection) --- |
| 99 | + - github.com/contextvibes/cli/internal/workitem.Provider |
| 100 | + - github.com/contextvibes/cli/internal/exec.CommandExecutor |
| 101 | + - github.com/contextvibes/cli/internal/workflow.PresenterInterface |
| 102 | + |
| 103 | + gosec: |
| 104 | + excludes: |
| 105 | + - G101 # Exclude "Hardcoded Credentials" (false positives with IaC resource names) |
| 106 | + |
| 107 | + errorlint: |
| 108 | + errorf: true |
| 109 | + asserts: true |
| 110 | + |
| 111 | + testifylint: |
| 112 | + enable-all: true |
| 113 | + |
| 114 | +issues: |
| 115 | + max-issues-per-linter: 0 |
| 116 | + max-same-issues: 0 |
| 117 | + exclude-dirs: |
| 118 | + - vendor |
0 commit comments