-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
grouper — a Go linter to analyze expression groups https://github.com/leonklingele/grouper
- Loading branch information
1 parent
e3d0247
commit 62b4d6a
Showing
6 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package golinters | ||
|
||
import ( | ||
"golang.org/x/tools/go/analysis" | ||
|
||
"github.com/golangci/golangci-lint/pkg/config" | ||
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis" | ||
|
||
grouper "github.com/leonklingele/grouper/pkg/analyzer" | ||
) | ||
|
||
func NewGrouper(settings *config.GrouperSettings) *goanalysis.Linter { | ||
linterCfg := map[string]map[string]interface{}{} | ||
if settings != nil { | ||
linterCfg["grouper"] = map[string]interface{}{ | ||
// const | ||
"const-require-single-const": settings.ConstRequireSingleConst, | ||
"const-require-grouping": settings.ConstRequireGrouping, | ||
// import | ||
"import-require-single-import": settings.ImportRequireSingleImport, | ||
"import-require-grouping": settings.ImportRequireGrouping, | ||
// type | ||
"type-require-single-type": settings.TypeRequireSingleType, | ||
"type-require-grouping": settings.TypeRequireGrouping, | ||
// var | ||
"var-require-single-var": settings.VarRequireSingleVar, | ||
"var-require-grouping": settings.VarRequireGrouping, | ||
} | ||
} | ||
|
||
return goanalysis.NewLinter( | ||
"grouper", | ||
"An analyzer to analyze expression groups.", | ||
[]*analysis.Analyzer{grouper.New()}, | ||
linterCfg, | ||
).WithLoadMode(goanalysis.LoadModeSyntax) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters