forked from rewe-digital/terraform-provider-sonarcloud
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.golangci.yml
More file actions
99 lines (83 loc) · 3.18 KB
/
.golangci.yml
File metadata and controls
99 lines (83 loc) · 3.18 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
---
version: 2
run:
timeout: 5m
go: '1.24'
linters:
enable:
# Enabled by default
- govet # Vet examines Go source code and reports suspicious constructs
- errcheck # Errcheck is a program for checking for unchecked errors in go programs
- staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks
- unused # Checks Go code for unused constants, variables, functions and types
- ineffassign # Detects when assignments to existing variables are not used
# Style and naming conventions
- revive # Fast, configurable, extensible, flexible, and beautiful linter for Go (drop-in replacement of golint)
# Bug detection
- bodyclose # Checks whether HTTP response body is closed successfully
- gocritic # Provides diagnostics that check for bugs, performance and style issues
- gosec # Inspects source code for security problems
- nilerr # Finds code that returns nil even if it checks that the error is not nil
- nilnesserr # Reports constructs that checks for err != nil, but returns a different nil value error
- unconvert # Remove unnecessary type conversions
- unparam # Reports unused function parameters
- wastedassign # Finds wasted assignment statements
# Performance
- prealloc # Find slice declarations that could potentially be pre-allocated
# Code complexity
- gocyclo # Computes and checks the cyclomatic complexity of functions
- gocognit # Computes and checks the cognitive complexity of functions
# Error handling
- errorlint # Find code that can cause problems with the error wrapping scheme introduced in Go 1.13
- errname # Checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error
# Code quality
- goconst # Finds repeated strings that could be replaced by a constant
- misspell # Finds commonly misspelled English words
- predeclared # Find code that shadows one of Go's predeclared identifiers
- whitespace # Checks for unnecessary newlines at the start and end of functions, if, for, etc
# Testing
- thelper # Detects test helpers which do not start with t.Helper() method
linters-settings:
revive:
rules:
- name: var-naming
severity: warning
disabled: false
arguments:
- ["ID", "URL", "HTTP", "API", "JSON", "XML", "HTML", "SQL"] # Allow common Go acronyms as uppercase
- name: exported
severity: warning
disabled: false
gocritic:
enabled-tags:
- diagnostic
- style
- performance
- experimental
- opinionated
disabled-checks:
- whyNoLint
- commentedOutCode
gocyclo:
min-complexity: 15 # Reasonable threshold - functions above this should be refactored
gocognit:
min-complexity: 30 # Higher threshold as cognitive complexity is stricter than cyclomatic
gosec:
excludes:
- G104 # Audit errors not checked - covered by errcheck
errorlint:
errorf: true
asserts: true
comparison: true
issues:
exclude-use-default: false
max-issues-per-linter: 0
max-same-issues: 0
exclude-rules:
# Exclude some linters from running on tests files
- path: _test\.go
linters:
- gocyclo
- gocognit
- funlen
- goconst