Skip to content

Commit

Permalink
Use NewRunner hook (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
wata727 committed Apr 9, 2023
1 parent 87bb0a3 commit d1d8095
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions google/ruleset.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package google

import (
"fmt"

"github.com/terraform-linters/tflint-plugin-sdk/hclext"
"github.com/terraform-linters/tflint-plugin-sdk/tflint"
)
Expand Down Expand Up @@ -43,17 +41,7 @@ func (r *RuleSet) ApplyConfig(body *hclext.BodyContent) error {
return nil
}

// Check runs inspections for each rule with the custom Google runner.
func (r *RuleSet) Check(rr tflint.Runner) error {
runner, err := NewRunner(rr, r.config)
if err != nil {
return err
}

for _, rule := range r.EnabledRules {
if err := rule.Check(runner); err != nil {
return fmt.Errorf("Failed to check `%s` rule: %s", rule.Name(), err)
}
}
return nil
// NewRunner injects a custom Google runner
func (r *RuleSet) NewRunner(runner tflint.Runner) (tflint.Runner, error) {
return NewRunner(runner, r.config)
}

0 comments on commit d1d8095

Please sign in to comment.