1
0
mirror of https://github.com/mgechev/revive.git synced 2025-11-23 22:04:49 +02:00

change: merge code-style with style categories (#1573)

* change: merge code-style with style categories

* deprecate variable
This commit is contained in:
Oleksandr Redko
2025-11-09 19:18:26 +02:00
committed by GitHub
parent 010d7b28ec
commit b73cca9e66
6 changed files with 7 additions and 5 deletions

View File

@@ -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"

View File

@@ -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{

View File

@@ -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",
})
}

View File

@@ -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{

View File

@@ -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(...)",
})

View File

@@ -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`,
})