diff --git a/providerlint/go.mod b/providerlint/go.mod index 48d6b3dcb921..3e6d770403ef 100644 --- a/providerlint/go.mod +++ b/providerlint/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/aws/aws-sdk-go v1.42.38 - github.com/bflad/tfproviderlint v0.27.1 + github.com/bflad/tfproviderlint v0.28.1 github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.1 golang.org/x/tools v0.0.0-20201028111035-eafbe7b904eb ) diff --git a/providerlint/go.sum b/providerlint/go.sum index 969b09a3444f..aae2da992da4 100644 --- a/providerlint/go.sum +++ b/providerlint/go.sum @@ -74,8 +74,8 @@ github.com/aws/aws-sdk-go v1.42.38 h1:/fNQTB4ZUQOa8+cfX7C7F0zyXRdiN1jGKKXt3+5nmz github.com/aws/aws-sdk-go v1.42.38/go.mod h1:OGr6lGMAKGlG9CVrYnWYDKIyb829c6EVBRjxqjmPepc= github.com/bflad/gopaniccheck v0.1.0 h1:tJftp+bv42ouERmUMWLoUn/5bi/iQZjHPznM00cP/bU= github.com/bflad/gopaniccheck v0.1.0/go.mod h1:ZCj2vSr7EqVeDaqVsWN4n2MwdROx1YL+LFo47TSWtsA= -github.com/bflad/tfproviderlint v0.27.1 h1:sYlc6R8cQ0NtaCCA7Oh1ld8xfn0oiwn6mm4unooi2fo= -github.com/bflad/tfproviderlint v0.27.1/go.mod h1:7Z9Pyl1Z1UWJcPBuyjN89D2NaJGpjReQb5NoaaQCthQ= +github.com/bflad/tfproviderlint v0.28.1 h1:7f54/ynV6/lK5/1EyG7tHtc4sMdjJSEFGjZNRJKwBs8= +github.com/bflad/tfproviderlint v0.28.1/go.mod h1:7Z9Pyl1Z1UWJcPBuyjN89D2NaJGpjReQb5NoaaQCthQ= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= diff --git a/providerlint/vendor/github.com/bflad/tfproviderlint/passes/commentignore/ignore.go b/providerlint/vendor/github.com/bflad/tfproviderlint/passes/commentignore/ignore.go index c934eae1c273..fb6767d318e7 100644 --- a/providerlint/vendor/github.com/bflad/tfproviderlint/passes/commentignore/ignore.go +++ b/providerlint/vendor/github.com/bflad/tfproviderlint/passes/commentignore/ignore.go @@ -40,19 +40,27 @@ func (ignorer *Ignorer) ShouldIgnore(key string, n ast.Node) bool { func run(pass *analysis.Pass) (interface{}, error) { ignores := map[string][]ignore{} for _, f := range pass.Files { - cmap := ast.NewCommentMap(pass.Fset, f, f.Comments) - for n, cgs := range cmap { - for _, cg := range cgs { - if strings.HasPrefix(cg.Text(), commentIgnorePrefix) { - commentIgnore := strings.TrimPrefix(cg.Text(), commentIgnorePrefix) - // Allow extra // comment after keys - commentIgnoreParts := strings.Split(commentIgnore, "//") - keys := strings.TrimSpace(commentIgnoreParts[0]) + for n, commentGroups := range ast.NewCommentMap(pass.Fset, f, f.Comments) { + for _, commentGroup := range commentGroups { + for _, comment := range commentGroup.List { + if comment == nil { + continue + } + + // Remove // comment prefix + commentText := strings.TrimLeft(strings.TrimPrefix(comment.Text, "//"), " ") + + if strings.HasPrefix(commentText, commentIgnorePrefix) { + commentIgnore := strings.TrimPrefix(commentText, commentIgnorePrefix) + // Allow extra // comment after keys + commentIgnoreParts := strings.Split(commentIgnore, "//") + keys := strings.TrimSpace(commentIgnoreParts[0]) - // Allow multiple comma separated ignores - for _, key := range strings.Split(keys, ",") { - // is it possible for nested pos/end to be outside the largest nodes? - ignores[key] = append(ignores[key], ignore{n.Pos(), n.End()}) + // Allow multiple comma separated ignores + for _, key := range strings.Split(keys, ",") { + // is it possible for nested pos/end to be outside the largest nodes? + ignores[key] = append(ignores[key], ignore{n.Pos(), n.End()}) + } } } } diff --git a/providerlint/vendor/modules.txt b/providerlint/vendor/modules.txt index e214ea865793..e484bf66d257 100644 --- a/providerlint/vendor/modules.txt +++ b/providerlint/vendor/modules.txt @@ -13,7 +13,7 @@ github.com/bflad/gopaniccheck/passes/logpaniccallexpr github.com/bflad/gopaniccheck/passes/logpanicfcallexpr github.com/bflad/gopaniccheck/passes/logpaniclncallexpr github.com/bflad/gopaniccheck/passes/paniccallexpr -# github.com/bflad/tfproviderlint v0.27.1 +# github.com/bflad/tfproviderlint v0.28.1 ## explicit github.com/bflad/tfproviderlint/helper/analysisutils github.com/bflad/tfproviderlint/helper/astutils