Skip to content

Commit

Permalink
passes/helper/validation: Pass for collecting `validation.StringInSli…
Browse files Browse the repository at this point in the history
…ce()` calls (#195)

Reference: hashicorp/terraform-provider-aws#14601
  • Loading branch information
Mikechoi78 committed Aug 14, 2020
1 parent 6ffd063 commit 712a036
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

ENHANCEMENTS

* passes/helper/validation: Pass for collecting `validation.StringInSlice()` calls
* passes/stdlib: Pass for collecting `fmt.Errorf()` calls

# v0.17.0
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package stringinslicecallexpr

import (
"github.com/bflad/tfproviderlint/helper/analysisutils"
"github.com/bflad/tfproviderlint/helper/terraformtype/helper/validation"
)

var Analyzer = analysisutils.FunctionCallExprAnalyzer(
"stringinslicecallexpr",
validation.IsFunc,
validation.PackagePath,
validation.FuncNameStringInSlice,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package stringinslicecallexpr

import (
"testing"

"golang.org/x/tools/go/analysis"
)

func TestValidateAnalyzer(t *testing.T) {
err := analysis.Validate([]*analysis.Analyzer{Analyzer})

if err != nil {
t.Fatal(err)
}
}

0 comments on commit 712a036

Please sign in to comment.