From b73cca9e66c7fa0d00a118fdbad260c7a361e16e Mon Sep 17 00:00:00 2001 From: Oleksandr Redko Date: Sun, 9 Nov 2025 19:18:26 +0200 Subject: [PATCH] change: merge code-style with style categories (#1573) * change: merge code-style with style categories * deprecate variable --- lint/failure.go | 2 ++ rule/file_length_limit.go | 2 +- rule/inefficient_map_lookup.go | 2 +- rule/line_length_limit.go | 2 +- rule/use_waitgroup_go.go | 2 +- rule/useless_fallthrough.go | 2 +- 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lint/failure.go b/lint/failure.go index d9ff93e..c25df48 100644 --- a/lint/failure.go +++ b/lint/failure.go @@ -11,6 +11,8 @@ const ( // FailureCategoryBadPractice indicates bad practice issues. FailureCategoryBadPractice FailureCategory = "bad practice" // FailureCategoryCodeStyle indicates code style issues. + // + // Deprecated: use FailureCategoryStyle instead. FailureCategoryCodeStyle FailureCategory = "code-style" // FailureCategoryComments indicates comment issues. FailureCategoryComments FailureCategory = "comments" diff --git a/rule/file_length_limit.go b/rule/file_length_limit.go index a9b4e8d..c24db43 100644 --- a/rule/file_length_limit.go +++ b/rule/file_length_limit.go @@ -57,7 +57,7 @@ func (r *FileLengthLimitRule) Apply(file *lint.File, _ lint.Arguments) []lint.Fa return []lint.Failure{ { - Category: lint.FailureCategoryCodeStyle, + Category: lint.FailureCategoryStyle, Confidence: 1, Position: lint.FailurePosition{ Start: token.Position{ diff --git a/rule/inefficient_map_lookup.go b/rule/inefficient_map_lookup.go index 6a92e14..b6e4bf9 100644 --- a/rule/inefficient_map_lookup.go +++ b/rule/inefficient_map_lookup.go @@ -99,7 +99,7 @@ func (w *lintInefficientMapLookup) analyzeBlock(b *ast.BlockStmt) { w.onFailure(lint.Failure{ Confidence: 1, Node: rangeOverMap, - Category: lint.FailureCategoryCodeStyle, + Category: lint.FailureCategoryStyle, Failure: "inefficient lookup of map key", }) } diff --git a/rule/line_length_limit.go b/rule/line_length_limit.go index 0c4c576..5d06539 100644 --- a/rule/line_length_limit.go +++ b/rule/line_length_limit.go @@ -76,7 +76,7 @@ func (r lintLineLengthNum) check() { c := utf8.RuneCountInString(t) if c > r.max { r.onFailure(lint.Failure{ - Category: lint.FailureCategoryCodeStyle, + Category: lint.FailureCategoryStyle, Position: lint.FailurePosition{ // Offset not set; it is non-trivial, and doesn't appear to be needed. Start: token.Position{ diff --git a/rule/use_waitgroup_go.go b/rule/use_waitgroup_go.go index 9dd80d7..2e58eb6 100644 --- a/rule/use_waitgroup_go.go +++ b/rule/use_waitgroup_go.go @@ -113,7 +113,7 @@ func (w *lintUseWaitGroupGo) analyzeBlock(b *ast.BlockStmt) { w.onFailure(lint.Failure{ Confidence: 1, Node: call, - Category: lint.FailureCategoryCodeStyle, + Category: lint.FailureCategoryStyle, Failure: "replace wg.Add()...go {...wg.Done()...} with wg.Go(...)", }) diff --git a/rule/useless_fallthrough.go b/rule/useless_fallthrough.go index c63f071..bef7757 100644 --- a/rule/useless_fallthrough.go +++ b/rule/useless_fallthrough.go @@ -81,7 +81,7 @@ func (w *lintUselessFallthrough) Visit(node ast.Node) ast.Visitor { w.onFailure(lint.Failure{ Confidence: confidence, Node: branchStmt, - Category: lint.FailureCategoryCodeStyle, + Category: lint.FailureCategoryStyle, Failure: `this "fallthrough" can be removed by consolidating this case clause with the next one`, })