feat: add openim make lint

This commit is contained in:
Xinwei Xiong(cubxxw) 2024-03-19 15:03:19 +08:00 committed by Xinwei Xiong (cubxxw)
parent 9ce3708a17
commit b0a3cbdf4f
30 changed files with 56 additions and 55 deletions

View File

@ -174,20 +174,18 @@ linters-settings:
# - ^print.*$ # - ^print.*$
- 'fmt\.Print.*' - 'fmt\.Print.*'
- fmt.Println.* # too much log noise - fmt.Println.* # too much log noise
- painc
# - ginkgo\\.F.* # these are used just for local development # - ginkgo\\.F.* # these are used just for local development
# # Exclude godoc examples from forbidigo checks. Default is true. # # Exclude godoc examples from forbidigo checks. Default is true.
# exclude_godoc_examples: false # exclude_godoc_examples: false
funlen: funlen:
lines: 150 lines: 220
statements: 80 statements: 80
gci:
# put imports beginning with prefix after 3rd-party packages;
# only support one prefix
# if not set, use goimports.local-prefixes
prefix: github.com/openimsdk/open-im-server
gocognit: gocognit:
# minimal code complexity to report, 30 by default (but we recommend 10-20) # minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 30 min-complexity: 30
goconst: goconst:
# minimal length of string constant, 3 by default # minimal length of string constant, 3 by default
min-len: 3 min-len: 3
@ -213,9 +211,6 @@ linters-settings:
# By default list of stable checks is used. # By default list of stable checks is used.
enabled-checks: enabled-checks:
#- rangeValCopy #- rangeValCopy
- nestingreduce
- truncatecmp
- unnamedresult
- ruleguard - ruleguard
# Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty # Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty
@ -286,6 +281,9 @@ linters-settings:
exclude: exclude:
# example: exclude comments which contain numbers # example: exclude comments which contain numbers
- '[0-9]+' - '[0-9]+'
- 'func\s+\w+'
- 'FIXME:'
- '.*func.*'
# check that each sentence starts with a capital letter # check that each sentence starts with a capital letter
capital: true capital: true
godox: godox:
@ -364,6 +362,7 @@ linters-settings:
retract-allow-no-explanation: false retract-allow-no-explanation: false
# Forbid the use of the `exclude` directives. Default is false. # Forbid the use of the `exclude` directives. Default is false.
exclude-forbidden: false exclude-forbidden: false
gomodguard: gomodguard:
allowed: allowed:
modules: modules:
@ -740,8 +739,10 @@ linters:
- dupword - dupword
- errname - errname
- gci - gci
- gocritic
- goprintffuncname - goprintffuncname
- gomnd - gomnd
- goconst
- gosec - gosec
- misspell # Spelling mistakes - misspell # Spelling mistakes
- staticcheck # Static analysis - staticcheck # Static analysis

View File

@ -433,7 +433,7 @@ func (c *conversationServer) conversationSort(conversations map[int64]string, re
keys = append(keys, key) keys = append(keys, key)
} }
sort.Slice(keys[:], func(i, j int) bool { sort.Slice(keys, func(i, j int) bool {
return keys[i] > keys[j] return keys[i] > keys[j]
}) })
index := 0 index := 0