@@ -17,34 +17,39 @@ const issues = " issues:"
17
17
18
18
// LinterExecute executes linters one by one
19
19
// todo: mechanism for disabling/enabling lint checks
20
- // todo: handle multiConfig
21
- func LinterExecute (config * vpcmodel.VPCConfig ) (issueFound bool , resString string ) {
22
- blinter := basicLinter {
23
- config : config ,
24
- }
25
- linters := []linter {
26
- & filterRuleSplitSubnet {basicLinter : blinter },
27
- }
28
- issueFound = false
29
- resString = "linting results for " + config .VPC .Name ()
30
- underline := strings .Repeat ("~" , len (resString ))
31
- resString += "\n " + underline + "\n \n "
32
- for _ , thisLinter := range linters {
33
- lintIssues , err := thisLinter .check ()
34
- if err != nil {
35
- fmt .Printf ("Lint %s got an error %s. Skipping this lint\n " , thisLinter .getName (), err .Error ())
36
- continue
20
+ func LinterExecute (configsMap map [string ]* vpcmodel.VPCConfig ) (issueFound bool , resString string ) {
21
+ for _ , config := range configsMap {
22
+ if config .IsMultipleVPCsConfig {
23
+ continue // no use in executing lint on dummy vpcs
24
+ }
25
+ blinter := basicLinter {
26
+ config : config ,
27
+ }
28
+ linters := []linter {
29
+ & filterRuleSplitSubnet {basicLinter : blinter },
37
30
}
38
- if len (lintIssues ) == 0 {
39
- fmt .Printf ("no lint %s issues\n " , thisLinter .getName ())
40
- continue
41
- } else {
42
- issueFound = true
31
+ issueFound = false
32
+ resString = "linting results for " + config .VPC .Name ()
33
+ underline := strings .Repeat ("~" , len (resString ))
34
+ resString += "\n " + underline + "\n \n "
35
+ for _ , thisLinter := range linters {
36
+ lintIssues , err := thisLinter .check ()
37
+ if err != nil {
38
+ fmt .Printf ("Lint %s got an error %s. Skipping this lint\n " , thisLinter .getName (), err .Error ())
39
+ continue
40
+ }
41
+ if len (lintIssues ) == 0 {
42
+ fmt .Printf ("no lint %s issues\n " , thisLinter .getName ())
43
+ continue
44
+ } else {
45
+ issueFound = true
46
+ }
47
+ resString += fmt .Sprintf ("%s%s\n " , thisLinter .getName (), issues ) +
48
+ strings .Repeat ("-" , len (thisLinter .getName ())+ len (issues )) + "\n " +
49
+ strings .Join (lintIssues , "" )
43
50
}
44
- resString += fmt .Sprintf ("%s%s\n " , thisLinter .getName (), issues ) +
45
- strings .Repeat ("-" , len (thisLinter .getName ())+ len (issues )) + "\n " +
46
- strings .Join (lintIssues , "" )
51
+ fmt .Printf ("%v" , resString )
52
+ return issueFound , resString
47
53
}
48
- fmt .Printf ("%v" , resString )
49
- return issueFound , resString
54
+ return false , ""
50
55
}
0 commit comments