forked from opendatahub-io/odh-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.golangci.yml
More file actions
122 lines (120 loc) · 4.31 KB
/
.golangci.yml
File metadata and controls
122 lines (120 loc) · 4.31 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
version: "2"
linters:
default: all
disable:
- wsl
- wsl_v5
- noinlineerr
- varnamelen
- exhaustruct
- ireturn
- depguard
- err113
- paralleltest
- funcorder
- funlen # Some functions intentionally long for clarity
- nilerr # Intentional: returning nil error with diagnostic result
- nilnil # Intentional: returning nil,nil for not-found cases
- lll # Line length handled by revive
- gocritic # Too opinionated
exclusions:
rules:
# Test files (includes benchmarks since they're in *_test.go files)
- path: '.*_test\.go$'
linters:
- forcetypeassert # Type assertion panics are acceptable in tests
- mnd
- maintidx # Large test functions with many cases are acceptable
- nestif # Some nesting acceptable in test helpers
- dupl # Similar test patterns are acceptable
- funlen
- goconst # Duplicate strings in test data are acceptable
- intrange # Go 1.22+ feature, not required
- rangeint # Go 1.22+ modernization, not required for tests
- revive # Allow 4 return values in test setup functions
- unparam # Test helpers may have unused parameters for flexibility
# Mock implementations
- path: 'pkg/util/test/mocks/.*\.go$'
linters:
- wrapcheck # Mocks must return errors as-is from testify/mock framework
settings:
wrapcheck:
ignore-package-globs:
- github.com/opendatahub-io/odh-cli/pkg/lint/check/validate
cyclop:
max-complexity: 15 # Increased from default 10
gocognit:
min-complexity: 50 # Increased from default 30
mnd:
ignored-functions:
- len
checks:
- argument
- case
- operation
- return
- assign
revive:
enable-all-rules: true
rules:
# Disable noisy rules that don't add value
- name: package-comments
disabled: true # Package comments not critical for examples/main packages
- name: dot-imports
disabled: true # Common practice for Gomega test assertions
- name: var-naming
disabled: true # "types" and "util" are reasonable package names
- name: line-length-limit
disabled: true # 80 character limit is too restrictive for modern code
- name: function-length
disabled: true # 75 line limit too restrictive for test functions
- name: cognitive-complexity
disabled: true # Complexity metrics are subjective
- name: add-constant
disabled: true # Too noisy for standard Go idioms (0 init, array indices, len checks)
- name: unchecked-type-assertion
disabled: true # Type assertions in tests are usually safe
- name: cyclomatic
disabled: true # Cyclomatic complexity is similar to cognitive complexity
- name: package-directory-mismatch
disabled: true # main_test pattern is intentional for example tests
- name: unused-receiver
disabled: true # Interface methods often don't need the receiver
- name: empty-lines
disabled: true
- name: struct-tag # json:",inline" is commonly used in kubernetes structs
arguments: [ "json,inline" ]
- name: max-public-structs
disabled: true # too strict
- name: exported
disabled: true # Comments on all exports too verbose
- name: if-return
disabled: true # Explicit error returns are clearer
- name: nested-structs
disabled: true # Nested structs acceptable for JSON/YAML tags
- name: use-waitgroup-go
disabled: true # Standard wg.Add/Done pattern is fine
- name: empty-block
disabled: true # Empty blocks with comments are intentional
- name: enforce-switch-style
disabled: true # default would make it more verbose
formatters:
enable:
- gci
- gofmt
- goimports
settings:
gci:
sections:
- standard
- default
- blank
- prefix(k8s.io)
- blank
- prefix(github.com/opendatahub-io/odh-cli)
- blank
- dot
custom-order: true
issues:
max-issues-per-linter: 0
max-same-issues: 0