feat: update golangci.yml file add and delete some linters (#1989)

pull/1991/head
Xinwei Xiong 4 months ago committed by GitHub
parent d384a16f16
commit 57331182c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -40,10 +40,14 @@ run:
# "/" will be replaced by current OS file path separator to properly work # "/" will be replaced by current OS file path separator to properly work
# on Windows. # on Windows.
skip-dirs: skip-dirs:
- components
- docs
- util - util
- .*~ - .*~
- api/swagger/docs - api/swagger/docs
- server/docs - server/docs
- components/mnt/config/certs
- logs
# default is true. Enables skipping of directories: # default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
@ -58,6 +62,11 @@ run:
skip-files: skip-files:
- ".*\\.my\\.go$" - ".*\\.my\\.go$"
- _test.go - _test.go
- ".*_test.go"
- "mocks/"
- ".github/"
- "logs/"
- "components/"
# by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules": # by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules":
# If invoked with -mod=readonly, the go command is disallowed from the implicit # If invoked with -mod=readonly, the go command is disallowed from the implicit
@ -131,8 +140,8 @@ linters-settings:
# path to a file containing a list of functions to exclude from checking # path to a file containing a list of functions to exclude from checking
# see https://github.com/kisielk/errcheck#excluding-functions for details # see https://github.com/kisielk/errcheck#excluding-functions for details
#exclude: errcheck.txt # exclude: errcheck.txt
errorlint: errorlint:
# Check whether fmt.Errorf uses the %w verb for formatting errors. See the readme for caveats # Check whether fmt.Errorf uses the %w verb for formatting errors. See the readme for caveats
errorf: true errorf: true
@ -418,7 +427,7 @@ linters-settings:
govet: govet:
# report about shadowed variables # report about shadowed variables
check-shadowing: true check-shadowing: false
# settings per analyzer # settings per analyzer
settings: settings:
@ -489,9 +498,9 @@ linters-settings:
- github.com\/user\/package\/v4\.Type - github.com\/user\/package\/v4\.Type
lll: lll:
# max line length, lines longer will be reported. Default is 120. # max line length, lines longer will be reported. Default is 250.
# '\t' is counted as 1 character by default, and can be changed with the tab-width option # '\t' is counted as 1 character by default, and can be changed with the tab-width option
line-length: 240 line-length: 250
# tab width in spaces. Default to 1. # tab width in spaces. Default to 1.
tab-width: 4 tab-width: 4
maligned: maligned:
@ -715,17 +724,19 @@ linters:
# enable-all: true # enable-all: true
disable-all: true disable-all: true
enable: enable:
- typecheck # 基本的类型检查 - typecheck # Basic type checking
- gofmt # 格式检查 - gofmt # Format check
- govet # Go 语言的标准检查工具 - govet # Go's standard linting tool
- gosimple # 简化代码的建议 - gosimple # Suggestions for simplifying code
- misspell # 拼写错误 - misspell # Spelling mistakes
- staticcheck # 静态检查 - staticcheck # Static analysis
- unused # 未使用的代码检查 - unused # Checks for unused code
- goimports # 检查导入是否正确排序和格式化 - goimports # Checks if imports are correctly sorted and formatted
- godot # 注释句点检查 - godot # Checks for comment punctuation
- bodyclose # 确保 HTTP response body 被关闭 - bodyclose # Ensures HTTP response body is closed
- errcheck # 检查是否遗漏了错误返回值 - stylecheck # Style checker for Go code
- unused # Checks for unused code
- errcheck # Checks for missed error returns
fast: true fast: true
issues: issues:
@ -792,6 +803,11 @@ issues:
- lll - lll
source: "^//go:generate " source: "^//go:generate "
- text: ".*[\u4e00-\u9fa5]+.*"
linters:
- golint
source: "^//.*$"
# Independently from option `exclude` we use default exclude patterns, # Independently from option `exclude` we use default exclude patterns,
# it can be disabled by this option. To list all # it can be disabled by this option. To list all
# excluded by default patterns execute `golangci-lint run --help`. # excluded by default patterns execute `golangci-lint run --help`.
@ -852,4 +868,4 @@ severity:
rules: rules:
- linters: - linters:
- dupl - dupl
severity: info severity: info

Loading…
Cancel
Save