Skip to content

Commit

Permalink
Use NewRunner hook (#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
wata727 authored Apr 22, 2023
1 parent c37220b commit 5f6887e
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions aws/ruleset.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package aws

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 AWS 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 AWS runner
func (r *RuleSet) NewRunner(runner tflint.Runner) (tflint.Runner, error) {
return NewRunner(runner, r.config)
}

0 comments on commit 5f6887e

Please sign in to comment.