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:
@@ -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"
|
||||
|
||||
@@ -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{
|
||||
|
||||
@@ -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",
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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{
|
||||
|
||||
@@ -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(...)",
|
||||
})
|
||||
|
||||
|
||||
@@ -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`,
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user