-
Notifications
You must be signed in to change notification settings - Fork 138
/
.golangci.yml
80 lines (75 loc) · 4.27 KB
/
.golangci.yml
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
# Copyright 2020-Present Couchbase, Inc.
#
# Use of this software is governed by the Business Source License included in
# the file licenses/BSL-Couchbase.txt. As of the Change Date specified in that
# file, in accordance with the Business Source License, use of this software
# will be governed by the Apache License, Version 2.0, included in the file
# licenses/APL2.txt.
# config file for golangci-lint
run:
timeout: 3m
linters:
enable:
- bodyclose # checks whether HTTP response body is closed successfully
- dupl # Tool for code clone detection
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases
- goconst # Finds repeated strings that could be replaced by a constant
- gocritic # The most opinionated Go source code linter
- goimports # Goimports does everything that gofmt does. Additionally it checks unused imports
- goprintffuncname # Checks that printf-like functions are named with `f` at the end
- gosec # (gas) Inspects source code for security problems
- gosimple # (megacheck) Linter for Go source code that specializes in simplifying a code
- govet # (vet, vetshadow) Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
- ineffassign # Detects when assignments to existing variables are not used
- misspell # Finds commonly misspelled English words in comments
- nakedret # Finds naked returns in functions greater than a specified function length
- prealloc # Finds slice declarations that could potentially be preallocated
- revive # Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes
- staticcheck # (megacheck) Staticcheck is a go vet on steroids, applying a ton of static analysis checks
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
- unconvert # Remove unnecessary type conversions
- unparam # Reports unused function parameters
- unused # (megacheck) Checks Go code for unused constants, variables, functions and types
disable:
- asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers
- depguard # Go linter that checks if package imports are in a list of acceptable packages
- dogsled # Checks assignments with too many blank identifiers # (e.g. x, _, _, _, := f())
- err113 # Golang linter to check the errors handling expressions
- funlen # Tool for detection of long functions
- gochecknoglobals # Checks that no globals are present in Go code
- gochecknoinits # Checks that no init functions are present in Go code
- gocognit # Computes and checks the cognitive complexity of functions
- gocyclo # Computes and checks the cyclomatic complexity of functions
- godot # Check if comments end in a period
- godox # Tool for detection of FIXME, TODO and other comment keywords
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
- gomnd # An analyzer to detect magic numbers.
- gomodguard # Allow and block list linter for direct Go module dependencies.
- lll # Reports long lines
- nestif # Reports deeply nested if statements
- nolintlint # Reports ill-formed or insufficient nolint directives
- rowserrcheck # checks whether Err of rows is checked successfully
- stylecheck # Stylecheck is a replacement for golint
- testpackage # linter that makes you use a separate _test package
- whitespace # Tool for detection of leading and trailing whitespace
- wsl # Whitespace Linter - Forces you to use empty lines!
linters-settings:
govet:
enable:
- fieldalignment # detect Go structs that would take less memory if their fields were sorted
gocritic:
enabled-checks:
- ruleguard
settings:
ruleguard:
rules: '${configDir}/ruleguard/*.go'
# Disable goconst in test files, often we have duplicated strings across tests, but don't make sense as constants.
issues:
exclude-rules:
- path: (_test\.go|utilities_testing\.go)
linters:
- goconst
- path: (_test\.go|utilities_testing\.go)
linters:
- govet
text: fieldalignment