Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
5nord committed Jul 22, 2024
2 parents f8ec1a6 + 0f2061b commit 6e81844
Showing 1 changed file with 38 additions and 2 deletions.
40 changes: 38 additions & 2 deletions lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ Naming Convention Checks
naming.component_consts Checks for component scoped constant identifiers.
naming.templates Checks for constant template identifiers.
naming.locals Checks for local variable identifiers.
naming.record Checks for record identifiers.
naming.set Checks for set identifiers.
naming.union Checks for union identifiers.
naming.enum Checks for enum identifiers
tags.tests Checks for module tags.
tags.modules Checks for module tags.
tags.tests Checks for test-case tags.
Expand Down Expand Up @@ -158,6 +162,10 @@ For information on writing new checks, see <TBD>.
ComponentConsts map[string]string `yaml:"component_consts"`
Templates map[string]string
Locals map[string]string
Record map[string]string
Set map[string]string
Union map[string]string
Enum map[string]string
}
Tags struct {
Modules map[string]string
Expand Down Expand Up @@ -281,7 +289,6 @@ func lint(cmd *cobra.Command, args []string) error {
case *syntax.PortTypeDecl:
checkNaming(n, style.Naming.PortTypes)
checkBraces(n.LBrace, n.RBrace)

case *syntax.Declarator:
if len(stack) <= 2 {
return true
Expand Down Expand Up @@ -337,8 +344,17 @@ func lint(cmd *cobra.Command, args []string) error {
checkBraces(n.LBrace, n.RBrace)
case *syntax.StructTypeDecl:
checkBraces(n.LBrace, n.RBrace)
switch n.Kind.Kind() {
case syntax.RECORD:
checkNaming(n, style.Naming.Record)
case syntax.SET:
checkNaming(n, style.Naming.Set)
case syntax.UNION:
checkNaming(n, style.Naming.Union)
}
case *syntax.EnumTypeDecl:
checkBraces(n.LBrace, n.RBrace)
checkNaming(n, style.Naming.Enum)
case *syntax.ImportDecl:
checkBraces(n.LBrace, n.RBrace)
checkImport(n, mod, tree)
Expand Down Expand Up @@ -717,6 +733,26 @@ func buildRegexCache() error {
return err
}
}
for p := range style.Naming.Record {
if err := cacheRegex(p); err != nil {
return err
}
}
for p := range style.Naming.Set {
if err := cacheRegex(p); err != nil {
return err
}
}
for p := range style.Naming.Union {
if err := cacheRegex(p); err != nil {
return err
}
}
for p := range style.Naming.Enum {
if err := cacheRegex(p); err != nil {
return err
}
}
for p := range style.Tags.Tests {
if err := cacheRegex(p); err != nil {
return err
Expand Down

0 comments on commit 6e81844

Please sign in to comment.