feat: add code lint

pull/2148/head
Xinwei Xiong (cubxxw) 2 years ago
parent 614250665b
commit 390c5b3e8b

1
.gitignore vendored

@ -34,7 +34,6 @@ deployments/charts/generated-configs/
### OpenIM Config ###
.env
config/config.yaml
config/openim.yaml
config/alertmanager.yml
config/prometheus.yml
config/email.tmpl

@ -39,19 +39,19 @@ run:
# from this option's value (see skip-dirs-use-default).
# "/" will be replaced by current OS file path separator to properly work
# on Windows.
skip-dirs:
- components
- docs
- util
- .*~
- api/swagger/docs
- server/docs
- components/mnt/config/certs
- logs
# skip-dirs:
# - components
# - docs
# - util
# - .*~
# - api/swagger/docs
# - server/docs
# - components/mnt/config/certs
# - logs
# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true
# skip-dirs-use-default: true
# which files to skip: they will be analyzed, but issues from them
# won't be reported. Default value is empty list, but there is
@ -59,15 +59,15 @@ run:
# autogenerated files. If it's not please let us know.
# "/" will be replaced by current OS file path separator to properly work
# on Windows.
skip-files:
- ".*\\.my\\.go$"
- _test.go
- ".*_test.go"
- "mocks/"
- ".github/"
- "logs/"
- "_output/"
- "components/"
# skip-files:
# - ".*\\.my\\.go$"
# - _test.go
# - ".*_test.go"
# - "mocks/"
# - ".github/"
# - "logs/"
# - "_output/"
# - "components/"
# 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
@ -87,7 +87,7 @@ run:
# output configuration options
output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
format: colored-line-number
# format: colored-line-number
# print lines of code with issue, default is true
print-issued-lines: true
@ -150,6 +150,11 @@ linters-settings:
comparison: true
exhaustive:
# Program elements to check for exhaustiveness.
# Default: [ switch ]
check:
- switch
- map
# check switch statements in generated files also
check-generated: false
# indicates that switch statements are to be considered exhaustive if a
@ -772,6 +777,7 @@ linters:
- dupword
- errname
- gci
- exhaustive
- gocritic
- goprintffuncname
- gomnd

Loading…
Cancel
Save