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 ### ### OpenIM Config ###
.env .env
config/config.yaml config/config.yaml
config/openim.yaml
config/alertmanager.yml config/alertmanager.yml
config/prometheus.yml config/prometheus.yml
config/email.tmpl config/email.tmpl

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

Loading…
Cancel
Save