Skip to content

Commit

Permalink
Add tag checking support for modules
Browse files Browse the repository at this point in the history
  • Loading branch information
5nord committed Jul 16, 2024
1 parent 102b83f commit d734da9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Naming Convention Checks
naming.templates Checks for constant template identifiers.
naming.locals Checks for local variable identifiers.
tags.tests Checks for module tags.
tags.tests Checks for test-case tags.
Expand Down Expand Up @@ -159,7 +160,8 @@ For information on writing new checks, see <TBD>.
Locals map[string]string
}
Tags struct {
Tests map[string]string
Modules map[string]string
Tests map[string]string
}
Ignore struct {
Modules []string
Expand Down Expand Up @@ -237,6 +239,7 @@ func lint(cmd *cobra.Command, args []string) error {

checkNaming(mod, style.Naming.Modules)
checkBraces(mod.LBrace, mod.RBrace)
checkTags(mod, style.Tags.Modules)
mod.Inspect(func(n syntax.Node) bool {
if n == nil {
stack = stack[:len(stack)-1]
Expand All @@ -246,6 +249,7 @@ func lint(cmd *cobra.Command, args []string) error {
stack = append(stack, n)

switch n := n.(type) {

case *syntax.Ident:
checkUsage(n)

Expand Down Expand Up @@ -718,6 +722,11 @@ func buildRegexCache() error {
return err
}
}
for p := range style.Tags.Modules {
if err := cacheRegex(p); err != nil {
return err
}
}
for _, p := range style.Ignore.Modules {
if err := cacheRegex(p); err != nil {
return err
Expand Down

0 comments on commit d734da9

Please sign in to comment.