-
Notifications
You must be signed in to change notification settings - Fork 23
new package: x/test #117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new package: x/test #117
Conversation
return false | ||
} | ||
|
||
func Gopt_Case_MatchAny(t CaseT, expected, got any, name ...string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cognitive complexity 45 of func Gopt_Case_MatchAny
is high (> 30) (gocognit)
Details
lint 解释
这个lint结果表明函数 Gopt_Case_MatchAny
的认知复杂度(cognitive complexity)为45,超过了推荐的阈值30。认知复杂度衡量的是理解代码所需的认知努力,高值可能意味着代码难以理解和维护。
错误用法
func Gopt_Case_MatchAny(input string) bool {
if input == "apple" || input == "banana" || input == "cherry" {
return true
}
// 其他复杂的逻辑...
}
在这个例子中,函数 Gopt_Case_MatchAny
通过多个条件判断来匹配输入字符串,导致认知复杂度较高。
正确用法
func Gopt_Case_MatchAny(input string) bool {
switch input {
case "apple", "banana", "cherry":
return true
default:
return false
}
}
通过使用 switch
语句,可以将多个条件判断简化为一个结构,从而降低认知复杂度。
💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #117 +/- ##
=======================================
Coverage 77.76% 77.76%
=======================================
Files 34 34
Lines 2145 2145
=======================================
Hits 1668 1668
Misses 432 432
Partials 45 45 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
type TySet[T baseelem] []T | ||
type TyAnySet []any | ||
|
||
func Set__0[T baseelem](vals ...T) TySet[T] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var-naming: don't use underscores in Go names; func Set__0 should be Set0 (revive)
Details
lint 解释
这个lint结果表明在Go代码中,函数名 Set__0
包含下划线。根据Go语言的命名规范,函数名应该避免使用下划线。
错误用法
func Set__0() {
// 函数体
}
正确用法
func Set0() {
// 函数体
}
💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流
return TySet[T](vals) | ||
} | ||
|
||
func Set__1[T []string](v *Var__3[T]) TySet[string] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var-naming: don't use underscores in Go names; func Set__1 should be Set1 (revive)
Details
lint 解释
这个lint结果表明在代码中使用了下划线命名法,这是Go语言中不推荐的做法。Go语言的命名约定是驼峰命名法(CamelCase),即每个单词的首字母大写,并且不使用下划线。
错误用法
func Set__1() {
// 函数体
}
在这个例子中,函数名 Set__1
使用了双下划线命名法,这是不正确的。
正确用法
func Set1() {
// 函数体
}
在这个例子中,函数名 Set1
使用了驼峰命名法,这是正确的。
💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流
return TySet[string](v.Val()) | ||
} | ||
|
||
func Set__2(vals ...any) TyAnySet { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var-naming: don't use underscores in Go names; func Set__2 should be Set2 (revive)
Details
lint 解释
这个lint结果表明在代码中使用了下划线命名法,这是Go语言中不推荐的做法。Go语言的命名约定是驼峰命名法(CamelCase),即每个单词的首字母大写,并且不使用下划线。
错误用法
func Set__2() {
// 函数体
}
在这个例子中,函数名 Set__2
使用了两个下划线 _2
,这是不正确的。
正确用法
func Set2() {
// 函数体
}
在这个例子中,函数名 Set2
使用了驼峰命名法,去掉了下划线,这是正确的。
💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流
} | ||
|
||
const ( | ||
Gopo_Gopt_Case_Match = "Gopt_Case_MatchTBase,Gopt_Case_MatchMap,Gopt_Case_MatchSlice,Gopt_Case_MatchBaseSlice,Gopt_Case_MatchSet,Gopt_Case_MatchAnySet,Gopt_Case_MatchAny" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var-naming: don't use underscores in Go names; const Gopo_Gopt_Case_Match should be GopoGoptCaseMatch (revive)
Details
lint 解释
这个lint结果表明在代码中使用了下划线命名法,这是Go语言中不推荐的做法。Go语言的命名规范是驼峰命名法(Camel Case),即每个单词的首字母大写,并且不使用下划线。
错误用法
const Gopo_Gopt_Case_Match = "some_value"
正确用法
const GopoGoptCaseMatch = "some_value"
💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流
Gopo_Gopt_Case_Match = "Gopt_Case_MatchTBase,Gopt_Case_MatchMap,Gopt_Case_MatchSlice,Gopt_Case_MatchBaseSlice,Gopt_Case_MatchSet,Gopt_Case_MatchAnySet,Gopt_Case_MatchAny" | ||
) | ||
|
||
func Gopt_Case_MatchTBase[T basetype](t CaseT, expected, got T, name ...string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var-naming: don't use underscores in Go names; func Gopt_Case_MatchTBase should be GoptCaseMatchTBase (revive)
Details
lint 解释
这个lint结果表明在Go语言中,函数名 Gopt_Case_MatchTBase
使用了下划线。根据Go语言的命名规范,函数名应该使用驼峰命名法(CamelCase),即每个单词的首字母大写,并且不使用下划线。
错误用法
func Gopt_Case_MatchTBase() {
// 函数体
}
正确用法
func GoptCaseMatchTBase() {
// 函数体
}
💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流
} | ||
} | ||
|
||
func Gopt_Case_MatchMap(t CaseT, expected, got map[string]any, name ...string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var-naming: don't use underscores in Go names; func Gopt_Case_MatchMap should be GoptCaseMatchMap (revive)
Details
lint 解释
这个lint结果表明在Go语言中,函数名 Gopt_Case_MatchMap
使用了下划线。根据Go语言的命名规范,函数名应该使用驼峰命名法(Camel Case),即每个单词的首字母大写,并且不使用下划线。
错误用法
func Gopt_Case_MatchMap() {
// 函数体
}
正确用法
func GoptCaseMatchMap() {
// 函数体
}
💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流
} | ||
} | ||
|
||
func Gopt_Case_MatchSlice(t CaseT, expected, got []any, name ...string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var-naming: don't use underscores in Go names; func Gopt_Case_MatchSlice should be GoptCaseMatchSlice (revive)
Details
lint 解释
这个lint结果表明在Go语言中,函数名 Gopt_Case_MatchSlice
使用了下划线。根据Go语言的命名规范,函数名应该使用驼峰命名法(Camel Case),即每个单词的首字母大写,并且不使用下划线。
错误用法
func Gopt_Case_MatchSlice() {
// 函数体
}
正确用法
func GoptCaseMatchSlice() {
// 函数体
}
💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流
} | ||
} | ||
|
||
func Gopt_Case_MatchBaseSlice[T baseelem](t CaseT, expected, got []T, name ...string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var-naming: don't use underscores in Go names; func Gopt_Case_MatchBaseSlice should be GoptCaseMatchBaseSlice (revive)
Details
lint 解释
这个lint结果表明在Go语言中,函数名不应该包含下划线。根据Go的命名规范,函数名应该使用驼峰命名法(Camel Case),即每个单词的首字母大写,不使用下划线分隔。
错误用法
func Gopt_Case_MatchBaseSlice() {
// 函数体
}
正确用法
func GoptCaseMatchBaseSlice() {
// 函数体
}
💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流
} | ||
} | ||
|
||
func Gopt_Case_MatchSet[T baseelem](t CaseT, expected TySet[T], got []T, name ...string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var-naming: don't use underscores in Go names; func Gopt_Case_MatchSet should be GoptCaseMatchSet (revive)
Details
lint 解释
这个lint结果表明在Go语言中,函数名 Gopt_Case_MatchSet
使用了下划线。根据Go语言的命名规范,函数名应该使用驼峰命名法(Camel Case),即每个单词的首字母大写,并且不使用下划线。
错误用法
func Gopt_Case_MatchSet() {
// 函数体
}
正确用法
func GoptCaseMatchSet() {
// 函数体
}
💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流
No description provided.