@@ -11,8 +11,6 @@ import (
11
11
"github.com/mgechev/revive/lint"
12
12
)
13
13
14
- // #region Revive API
15
-
16
14
// StringFormatRule lints strings and/or comments according to a set of regular expressions given as Arguments
17
15
type StringFormatRule struct {}
18
16
@@ -56,10 +54,6 @@ func (StringFormatRule) ParseArgumentsTest(arguments lint.Arguments) *string {
56
54
return nil
57
55
}
58
56
59
- // #endregion
60
-
61
- // #region Internal structure
62
-
63
57
type lintStringFormatRule struct {
64
58
onFailure func (lint.Failure )
65
59
rules []stringFormatSubrule
@@ -87,10 +81,6 @@ const identRegex = "[_A-Za-z][_A-Za-z0-9]*"
87
81
var parseStringFormatScope = regexp .MustCompile (
88
82
fmt .Sprintf ("^(%s(?:\\ .%s)?)(?:\\ [([0-9]+)\\ ](?:\\ .(%s))?)?$" , identRegex , identRegex , identRegex ))
89
83
90
- // #endregion
91
-
92
- // #region Argument parsing
93
-
94
84
func (w * lintStringFormatRule ) parseArguments (arguments lint.Arguments ) {
95
85
for i , argument := range arguments {
96
86
scopes , regex , negated , errorMessage := w .parseArgument (argument , i )
@@ -196,10 +186,6 @@ func (lintStringFormatRule) parseScopeError(msg string, ruleNum, option, scopeNu
196
186
panic (fmt .Sprintf ("failed to parse configuration for string-format: %s [argument %d, option %d, scope index %d]" , msg , ruleNum , option , scopeNum ))
197
187
}
198
188
199
- // #endregion
200
-
201
- // #region Node traversal
202
-
203
189
func (w lintStringFormatRule ) Visit (node ast.Node ) ast.Visitor {
204
190
// First, check if node is a call expression
205
191
call , ok := node .(* ast.CallExpr )
@@ -247,10 +233,6 @@ func (lintStringFormatRule) getCallName(call *ast.CallExpr) (callName string, ok
247
233
return "" , false
248
234
}
249
235
250
- // #endregion
251
-
252
- // #region Linting logic
253
-
254
236
// apply a single format rule to a call expression (should be done after verifying the that the call expression matches the rule's scope)
255
237
func (r * stringFormatSubrule ) apply (call * ast.CallExpr , scope * stringFormatSubruleScope ) {
256
238
if len (call .Args ) <= scope .argument {
@@ -324,5 +306,3 @@ func (r *stringFormatSubrule) generateFailure(node ast.Node) {
324
306
Node : node ,
325
307
})
326
308
}
327
-
328
- // #endregion
0 commit comments