pkg/task/.golangci.yml

97 lines
2.0 KiB
YAML

version: "2"
run:
timeout: 5m
# tests: false # 过滤_test.go文件
build-tags:
- goexperiment.jsonv2
issues:
# 显示所有 issue
max-issues-per-linter: 0
max-same-issues: 0
formatters:
# 必须在enable打开才能用
enable:
- gofmt
- gci
settings:
gci:
sections:
- standard
- default
- prefix(git.ifooth.com/common/pkg/task)
custom-order: true
linters:
enable:
# enable by default
- errcheck
- govet
- ineffassign
- staticcheck
- unused
# custom
- goconst
- goheader
- gosec
- misspell
- nakedret
- revive
- unconvert
- unparam
- modernize
# 忽略特定错误
# exclusions:
# rules:
# - linters:
# - govet
# text: 'shadow: declaration of "err" shadows declaration'
settings:
# 只开启特定的规则
errcheck:
exclude-functions:
- (*os.File).Close
- (io.Closer).Close
- (net/http.ResponseWriter).Write
- io.Copy
- os.RemoveAll
govet:
enable:
- shadow
gosec:
includes:
- G201 # SQL query construction using format string
- G202 # SQL query construction using string concatenation
- G101 # Look for hard coded credentials
- G401 # Detect the usage of DES, RC4, MD5 or SHA1
- G402 # Look for bad TLS connection settings
- G403 # Ensure minimum RSA key length of 2048 bits
- G504 # Import blocklist: net/http/cgi
misspell:
locale: US
revive:
rules:
- name: line-length-limit
arguments:
- 120
- name: function-length
arguments:
- 80 # statements
- 80 # lines
- name: cyclomatic
arguments:
- 20
- name: use-any
- name: early-return
- name: exported
arguments:
- checkPrivateReceivers
- sayRepetitiveInsteadOfStutters
- name: package-comments