diff --git a/lint/linter.go b/lint/linter.go index 441f230ce..6ecaa8da1 100644 --- a/lint/linter.go +++ b/lint/linter.go @@ -102,8 +102,8 @@ func (l *Linter) Lint(packages [][]string, ruleSet []Rule, config Config) (<-cha } var wg sync.WaitGroup + wg.Add(len(packages)) for n := range packages { - wg.Add(1) go func(pkg []string, gover *goversion.Version) { if err := l.lintPackage(pkg, gover, ruleSet, config, failures); err != nil { fmt.Fprintln(os.Stderr, "error during linting: "+err.Error()) diff --git a/rule/string_format.go b/rule/string_format.go index 2a608b500..1061131a6 100644 --- a/rule/string_format.go +++ b/rule/string_format.go @@ -11,8 +11,6 @@ import ( "github.com/mgechev/revive/lint" ) -// #region Revive API - // StringFormatRule lints strings and/or comments according to a set of regular expressions given as Arguments type StringFormatRule struct{} @@ -59,10 +57,6 @@ func (StringFormatRule) ParseArgumentsTest(arguments lint.Arguments) *string { return nil } -// #endregion - -// #region Internal structure - type lintStringFormatRule struct { onFailure func(lint.Failure) rules []stringFormatSubrule @@ -90,10 +84,6 @@ const identRegex = "[_A-Za-z][_A-Za-z0-9]*" var parseStringFormatScope = regexp.MustCompile( fmt.Sprintf("^(%s(?:\\.%s)?)(?:\\[([0-9]+)\\](?:\\.(%s))?)?$", identRegex, identRegex, identRegex)) -// #endregion - -// #region Argument parsing - func (w *lintStringFormatRule) parseArguments(arguments lint.Arguments) error { for i, argument := range arguments { scopes, regex, negated, errorMessage, err := w.parseArgument(argument, i) @@ -203,10 +193,6 @@ func (lintStringFormatRule) parseScopeError(msg string, ruleNum, option, scopeNu return fmt.Errorf("failed to parse configuration for string-format: %s [argument %d, option %d, scope index %d]", msg, ruleNum, option, scopeNum) } -// #endregion - -// #region Node traversal - func (w lintStringFormatRule) Visit(node ast.Node) ast.Visitor { // First, check if node is a call expression call, ok := node.(*ast.CallExpr) @@ -254,10 +240,6 @@ func (lintStringFormatRule) getCallName(call *ast.CallExpr) (callName string, ok return "", false } -// #endregion - -// #region Linting logic - // apply a single format rule to a call expression (should be done after verifying the that the call expression matches the rule's scope) func (r *stringFormatSubrule) apply(call *ast.CallExpr, scope *stringFormatSubruleScope) { if len(call.Args) <= scope.argument { @@ -331,5 +313,3 @@ func (r *stringFormatSubrule) generateFailure(node ast.Node) { Node: node, }) } - -// #endregion