From dc9dae26e1263148402a4f95a1598acb6693eb1f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Mar 2021 18:10:42 +0000 Subject: [PATCH] build(deps): Bump github.com/bflad/tfproviderlint in /awsproviderlint (#18434) --- awsproviderlint/go.mod | 2 +- awsproviderlint/go.sum | 9 ++- .../helper/analysisutils/analyzers.go | 21 ++++++ .../helper/analysisutils/runners.go | 68 +++++++++++++++++++ .../helper/analysisutils/stdlib_analyzers.go | 13 ++++ .../helper/analysisutils/stdlib_runners.go | 23 +++++++ .../helper/schema/type_resource.go | 40 ++++++----- .../osexeccommandcallexpr.go | 11 +++ .../osexeccommandcontextcallexpr.go | 11 +++ .../osexeccommandcontextselectorexpr.go | 11 +++ .../osexeccommandselectorexpr.go | 11 +++ .../tfproviderlint/xpasses/XR006/XR006.go | 8 +-- .../tfproviderlint/xpasses/XR007/README.md | 28 ++++++++ .../tfproviderlint/xpasses/XR007/XR007.go | 15 ++++ .../tfproviderlint/xpasses/XR008/README.md | 28 ++++++++ .../tfproviderlint/xpasses/XR008/XR008.go | 15 ++++ .../bflad/tfproviderlint/xpasses/checks.go | 4 ++ awsproviderlint/vendor/modules.txt | 8 ++- 18 files changed, 297 insertions(+), 29 deletions(-) create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcallexpr/osexeccommandcallexpr.go create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcontextcallexpr/osexeccommandcontextcallexpr.go create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcontextselectorexpr/osexeccommandcontextselectorexpr.go create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandselectorexpr/osexeccommandselectorexpr.go create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR007/README.md create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR007/XR007.go create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR008/README.md create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR008/XR008.go diff --git a/awsproviderlint/go.mod b/awsproviderlint/go.mod index 369eeda6f03..d726f48f4b5 100644 --- a/awsproviderlint/go.mod +++ b/awsproviderlint/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/aws/aws-sdk-go v1.38.6 - github.com/bflad/tfproviderlint v0.24.0 + github.com/bflad/tfproviderlint v0.26.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.5.0 golang.org/x/tools v0.0.0-20201028111035-eafbe7b904eb ) diff --git a/awsproviderlint/go.sum b/awsproviderlint/go.sum index d03f71c440f..ab6f15db173 100644 --- a/awsproviderlint/go.sum +++ b/awsproviderlint/go.sum @@ -62,8 +62,8 @@ github.com/aws/aws-sdk-go v1.38.6 h1:h0AKIaz/A1kEJ50HxCv7tL1GW+KbxYbp75+lZ/nvFOI github.com/aws/aws-sdk-go v1.38.6/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= 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.24.0 h1:q7nuajx5fjlaH4L4DUDoNlME+MkaHUHDv5d20qmXJ6Y= -github.com/bflad/tfproviderlint v0.24.0/go.mod h1:hvNY+Nthz7T/LHmycyyBfgfHvtmkHVgZTwfVD89er3U= +github.com/bflad/tfproviderlint v0.26.0 h1:Xd+hbVlSQhKlXifpqmHPvlcnOK1lRS4IZf+cXBAUpCs= +github.com/bflad/tfproviderlint v0.26.0/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= @@ -206,9 +206,8 @@ github.com/hashicorp/terraform-json v0.8.0 h1:XObQ3PgqU52YLQKEaJ08QtUshAfN3yu4u8 github.com/hashicorp/terraform-json v0.8.0/go.mod h1:3defM4kkMfttwiE7VakJDwCd4R+umhSQnvJwORXbprE= github.com/hashicorp/terraform-plugin-go v0.2.1 h1:EW/R8bB2Zbkjmugzsy1d27yS8/0454b3MtYHkzOknqA= github.com/hashicorp/terraform-plugin-go v0.2.1/go.mod h1:10V6F3taeDWVAoLlkmArKttR3IULlRWFAGtQIQTIDr4= -github.com/hashicorp/terraform-plugin-sdk v1.16.1-0.20210222152151-32f0219df5b5 h1:ECRaTJhZpRUs7SHB7qHIT4+elRSEWSOYvSx7T4Y0cVo= -github.com/hashicorp/terraform-plugin-sdk v1.16.1-0.20210222152151-32f0219df5b5/go.mod h1:KSsGcuZ1JRqnmYzz+sWIiUwNvJkzXbGRIdefwFfOdyY= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.4.4/go.mod h1:z+cMZ0iswzZOahBJ3XmNWgWkVnAd2bl8g+FhyyuPDH4= +github.com/hashicorp/terraform-plugin-sdk v1.16.1 h1:G2iK7MBT4LuNcVASPXWS1ciBUuIm8oIY0zRfCmi3xy4= +github.com/hashicorp/terraform-plugin-sdk v1.16.1/go.mod h1:KSsGcuZ1JRqnmYzz+sWIiUwNvJkzXbGRIdefwFfOdyY= github.com/hashicorp/terraform-plugin-sdk/v2 v2.5.0 h1:4EHNOAjwiYCeBxY16rt2KwyRNNVsCaVO3kWBbiXfYM0= github.com/hashicorp/terraform-plugin-sdk/v2 v2.5.0/go.mod h1:z+cMZ0iswzZOahBJ3XmNWgWkVnAd2bl8g+FhyyuPDH4= github.com/hashicorp/terraform-plugin-test/v2 v2.1.3/go.mod h1:pmaUHiUtDL/8Mz3FuyZ/vRDb0LpaOWQjVRW9ORF7FHs= diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/analyzers.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/analyzers.go index b5fcb049387..9fc2a16b874 100644 --- a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/analyzers.go +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/analyzers.go @@ -11,6 +11,27 @@ import ( "golang.org/x/tools/go/analysis/passes/inspect" ) +// AvoidSelectorExprAnalyzer returns an Analyzer for *ast.SelectorExpr to avoid +func AvoidSelectorExprAnalyzer(analyzerName string, callExprAnalyzer, selectorExprAnalyzer *analysis.Analyzer, packagePath, typeName string) *analysis.Analyzer { + doc := fmt.Sprintf(`check for %[2]s.%[3]s usage to avoid + +The %[1]s analyzer reports usage: + +%[2]s.%[3]s +`, analyzerName, packagePath, typeName) + + return &analysis.Analyzer{ + Name: analyzerName, + Doc: doc, + Requires: []*analysis.Analyzer{ + callExprAnalyzer, + commentignore.Analyzer, + selectorExprAnalyzer, + }, + Run: AvoidSelectorExprRunner(analyzerName, callExprAnalyzer, selectorExprAnalyzer, packagePath, typeName), + } +} + // DeprecatedReceiverMethodSelectorExprAnalyzer returns an Analyzer for deprecated *ast.SelectorExpr func DeprecatedReceiverMethodSelectorExprAnalyzer(analyzerName string, callExprAnalyzer, selectorExprAnalyzer *analysis.Analyzer, packagePath, typeName, methodName string) *analysis.Analyzer { doc := fmt.Sprintf(`check for deprecated %[2]s.%[3]s usage diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/runners.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/runners.go index 50b44083efe..2c7cc9ccfca 100644 --- a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/runners.go +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/runners.go @@ -15,6 +15,74 @@ import ( "golang.org/x/tools/go/ast/inspector" ) +// AvoidSelectorExprRunner returns an Analyzer runner for *ast.SelectorExpr to avoid +func AvoidSelectorExprRunner(analyzerName string, callExprAnalyzer, selectorExprAnalyzer *analysis.Analyzer, packagePath, typeName string) func(*analysis.Pass) (interface{}, error) { + return func(pass *analysis.Pass) (interface{}, error) { + callExprs := pass.ResultOf[callExprAnalyzer].([]*ast.CallExpr) + selectorExprs := pass.ResultOf[selectorExprAnalyzer].([]*ast.SelectorExpr) + ignorer := pass.ResultOf[commentignore.Analyzer].(*commentignore.Ignorer) + + // CallExpr and SelectorExpr will overlap, so only perform one report/fix + reported := make(map[token.Pos]struct{}) + + for _, callExpr := range callExprs { + if ignorer.ShouldIgnore(analyzerName, callExpr) { + continue + } + + pass.Report(analysis.Diagnostic{ + Pos: callExpr.Pos(), + End: callExpr.End(), + Message: fmt.Sprintf("%s: avoid %s.%s", analyzerName, packagePath, typeName), + SuggestedFixes: []analysis.SuggestedFix{ + { + Message: "Remove", + TextEdits: []analysis.TextEdit{ + { + Pos: callExpr.Pos(), + End: callExpr.End(), + NewText: []byte{}, + }, + }, + }, + }, + }) + + reported[callExpr.Pos()] = struct{}{} + } + + for _, selectorExpr := range selectorExprs { + if ignorer.ShouldIgnore(analyzerName, selectorExpr) { + continue + } + + if _, ok := reported[selectorExpr.Pos()]; ok { + continue + } + + pass.Report(analysis.Diagnostic{ + Pos: selectorExpr.Pos(), + End: selectorExpr.End(), + Message: fmt.Sprintf("%s: avoid %s.%s", analyzerName, packagePath, typeName), + SuggestedFixes: []analysis.SuggestedFix{ + { + Message: "Remove", + TextEdits: []analysis.TextEdit{ + { + Pos: selectorExpr.Pos(), + End: selectorExpr.End(), + NewText: []byte{}, + }, + }, + }, + }, + }) + } + + return nil, nil + } +} + // DeprecatedReceiverMethodSelectorExprRunner returns an Analyzer runner for deprecated *ast.SelectorExpr func DeprecatedReceiverMethodSelectorExprRunner(analyzerName string, callExprAnalyzer, selectorExprAnalyzer *analysis.Analyzer, packagePath, typeName, methodName string) func(*analysis.Pass) (interface{}, error) { return func(pass *analysis.Pass) (interface{}, error) { diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/stdlib_analyzers.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/stdlib_analyzers.go index df0a1dbd238..e21f27ae6fe 100644 --- a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/stdlib_analyzers.go +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/stdlib_analyzers.go @@ -21,3 +21,16 @@ func StdlibFunctionCallExprAnalyzer(analyzerName string, packagePath string, fun ResultType: reflect.TypeOf([]*ast.CallExpr{}), } } + +// StdlibFunctionSelectorExprAnalyzer returns an Analyzer for standard library function *ast.SelectorExpr +func StdlibFunctionSelectorExprAnalyzer(analyzerName string, packagePath string, functionName string) *analysis.Analyzer { + return &analysis.Analyzer{ + Name: analyzerName, + Doc: fmt.Sprintf("find %s.%s() selectors for later passes", packagePath, functionName), + Requires: []*analysis.Analyzer{ + inspect.Analyzer, + }, + Run: StdlibFunctionSelectorExprRunner(packagePath, functionName), + ResultType: reflect.TypeOf([]*ast.SelectorExpr{}), + } +} diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/stdlib_runners.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/stdlib_runners.go index 36ad4bf8687..a5dee95c21c 100644 --- a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/stdlib_runners.go +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/stdlib_runners.go @@ -31,3 +31,26 @@ func StdlibFunctionCallExprRunner(packagePath string, functionName string) func( return result, nil } } + +// StdlibFunctionSelectorExprRunner returns an Analyzer runner for function *ast.SelectorExpr +func StdlibFunctionSelectorExprRunner(packagePath string, functionName string) func(*analysis.Pass) (interface{}, error) { + return func(pass *analysis.Pass) (interface{}, error) { + inspect := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector) + nodeFilter := []ast.Node{ + (*ast.SelectorExpr)(nil), + } + var result []*ast.SelectorExpr + + inspect.Preorder(nodeFilter, func(n ast.Node) { + selectorExpr := n.(*ast.SelectorExpr) + + if !astutils.IsStdlibPackageFunc(selectorExpr, pass.TypesInfo, packagePath, functionName) { + return + } + + result = append(result, selectorExpr) + }) + + return result, nil + } +} diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/terraformtype/helper/schema/type_resource.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/terraformtype/helper/schema/type_resource.go index 2bac427df55..1d8f75b22ca 100644 --- a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/terraformtype/helper/schema/type_resource.go +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/terraformtype/helper/schema/type_resource.go @@ -9,24 +9,28 @@ import ( ) const ( - ResourceFieldCreate = `Create` - ResourceFieldCreateContext = `CreateContext` - ResourceFieldCustomizeDiff = `CustomizeDiff` - ResourceFieldDelete = `Delete` - ResourceFieldDeleteContext = `DeleteContext` - ResourceFieldDeprecationMessage = `DeprecationMessage` - ResourceFieldDescription = `Description` - ResourceFieldExists = `Exists` - ResourceFieldImporter = `Importer` - ResourceFieldMigrateState = `MigrateState` - ResourceFieldRead = `Read` - ResourceFieldReadContext = `ReadContext` - ResourceFieldSchema = `Schema` - ResourceFieldSchemaVersion = `SchemaVersion` - ResourceFieldStateUpgraders = `StateUpgraders` - ResourceFieldTimeouts = `Timeouts` - ResourceFieldUpdate = `Update` - ResourceFieldUpdateContext = `UpdateContext` + ResourceFieldCreate = `Create` + ResourceFieldCreateContext = `CreateContext` + ResourceFieldCreateWithoutTimeout = `CreateWithoutTimeout` + ResourceFieldCustomizeDiff = `CustomizeDiff` + ResourceFieldDelete = `Delete` + ResourceFieldDeleteContext = `DeleteContext` + ResourceFieldDeleteWithoutTimeout = `DeleteWithoutTimeout` + ResourceFieldDeprecationMessage = `DeprecationMessage` + ResourceFieldDescription = `Description` + ResourceFieldExists = `Exists` + ResourceFieldImporter = `Importer` + ResourceFieldMigrateState = `MigrateState` + ResourceFieldRead = `Read` + ResourceFieldReadContext = `ReadContext` + ResourceFieldReadWithoutTimeout = `ReadWithoutTimeout` + ResourceFieldSchema = `Schema` + ResourceFieldSchemaVersion = `SchemaVersion` + ResourceFieldStateUpgraders = `StateUpgraders` + ResourceFieldTimeouts = `Timeouts` + ResourceFieldUpdate = `Update` + ResourceFieldUpdateContext = `UpdateContext` + ResourceFieldUpdateWithoutTimeout = `UpdateWithoutTimeout` TypeNameResource = `Resource` ) diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcallexpr/osexeccommandcallexpr.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcallexpr/osexeccommandcallexpr.go new file mode 100644 index 00000000000..c39ce0e3f18 --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcallexpr/osexeccommandcallexpr.go @@ -0,0 +1,11 @@ +package osexeccommandcallexpr + +import ( + "github.com/bflad/tfproviderlint/helper/analysisutils" +) + +var Analyzer = analysisutils.StdlibFunctionCallExprAnalyzer( + "osexeccommandcallexpr", + "os/exec", + "Command", +) diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcontextcallexpr/osexeccommandcontextcallexpr.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcontextcallexpr/osexeccommandcontextcallexpr.go new file mode 100644 index 00000000000..50a38373591 --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcontextcallexpr/osexeccommandcontextcallexpr.go @@ -0,0 +1,11 @@ +package osexeccommandcontextcallexpr + +import ( + "github.com/bflad/tfproviderlint/helper/analysisutils" +) + +var Analyzer = analysisutils.StdlibFunctionCallExprAnalyzer( + "osexeccommandcontextcallexpr", + "os/exec", + "CommandContext", +) diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcontextselectorexpr/osexeccommandcontextselectorexpr.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcontextselectorexpr/osexeccommandcontextselectorexpr.go new file mode 100644 index 00000000000..18b7e3706c2 --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcontextselectorexpr/osexeccommandcontextselectorexpr.go @@ -0,0 +1,11 @@ +package osexeccommandcontextselectorexpr + +import ( + "github.com/bflad/tfproviderlint/helper/analysisutils" +) + +var Analyzer = analysisutils.StdlibFunctionSelectorExprAnalyzer( + "osexeccommandselectorexpr", + "os/exec", + "CommandContext", +) diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandselectorexpr/osexeccommandselectorexpr.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandselectorexpr/osexeccommandselectorexpr.go new file mode 100644 index 00000000000..a90a13d720c --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandselectorexpr/osexeccommandselectorexpr.go @@ -0,0 +1,11 @@ +package osexeccommandselectorexpr + +import ( + "github.com/bflad/tfproviderlint/helper/analysisutils" +) + +var Analyzer = analysisutils.StdlibFunctionSelectorExprAnalyzer( + "osexeccommandselectorexpr", + "os/exec", + "Command", +) diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR006/XR006.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR006/XR006.go index d9c8d405fce..6d89ae4b74f 100644 --- a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR006/XR006.go +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR006/XR006.go @@ -32,19 +32,19 @@ func run(pass *analysis.Pass) (interface{}, error) { continue } - if !resource.DeclaresField(schema.ResourceFieldCreate) && !resource.DeclaresField(schema.ResourceFieldCreateContext) && resource.Resource.Timeouts.Create != nil { + if !resource.DeclaresField(schema.ResourceFieldCreate) && !resource.DeclaresField(schema.ResourceFieldCreateContext) && !resource.DeclaresField(schema.ResourceFieldCreateWithoutTimeout) && resource.Resource.Timeouts.Create != nil { pass.Reportf(resource.AstCompositeLit.Pos(), "%s: resource should not configure Timeouts.Create without Create implementation", analyzerName) } - if !resource.DeclaresField(schema.ResourceFieldDelete) && !resource.DeclaresField(schema.ResourceFieldDeleteContext) && resource.Resource.Timeouts.Delete != nil { + if !resource.DeclaresField(schema.ResourceFieldDelete) && !resource.DeclaresField(schema.ResourceFieldDeleteContext) && !resource.DeclaresField(schema.ResourceFieldDeleteWithoutTimeout) && resource.Resource.Timeouts.Delete != nil { pass.Reportf(resource.AstCompositeLit.Pos(), "%s: resource should not configure Timeouts.Delete without Delete implementation", analyzerName) } - if !resource.DeclaresField(schema.ResourceFieldRead) && !resource.DeclaresField(schema.ResourceFieldReadContext) && resource.Resource.Timeouts.Read != nil { + if !resource.DeclaresField(schema.ResourceFieldRead) && !resource.DeclaresField(schema.ResourceFieldReadContext) && !resource.DeclaresField(schema.ResourceFieldReadWithoutTimeout) && resource.Resource.Timeouts.Read != nil { pass.Reportf(resource.AstCompositeLit.Pos(), "%s: resource should not configure Timeouts.Read without Read implementation", analyzerName) } - if !resource.DeclaresField(schema.ResourceFieldUpdate) && !resource.DeclaresField(schema.ResourceFieldUpdateContext) && resource.Resource.Timeouts.Update != nil { + if !resource.DeclaresField(schema.ResourceFieldUpdate) && !resource.DeclaresField(schema.ResourceFieldUpdateContext) && !resource.DeclaresField(schema.ResourceFieldUpdateWithoutTimeout) && resource.Resource.Timeouts.Update != nil { pass.Reportf(resource.AstCompositeLit.Pos(), "%s: resource should not configure Timeouts.Update without Update implementation", analyzerName) } } diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR007/README.md b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR007/README.md new file mode 100644 index 00000000000..bd827290864 --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR007/README.md @@ -0,0 +1,28 @@ +# XR007 + +The XR007 analyzer reports usage of the [`os/exec.Command()`](https://pkg.go.dev/os/exec#Command) function. Providers that are using Go language based SDKs likely want to prevent any execution of other binaries for various reasons such as security and unexpected requirements (e.g. tool installation outside Terraform). + +## Flagged Code + +```go +var sneaky = exec.Command + +sneaky("evilprogram") + +exec.Command("evilprogram") +``` + +## Passing Code + +```go +// Not present :) +``` + +## Ignoring Reports + +Singular reports can be ignored by adding the a `//lintignore:XR007` Go code comment at the end of the offending line or on the line immediately proceding, e.g. + +```go +//lintignore:XR007 +exec.Command("evilprogram") +``` diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR007/XR007.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR007/XR007.go new file mode 100644 index 00000000000..5db4c3ab93d --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR007/XR007.go @@ -0,0 +1,15 @@ +package XR007 + +import ( + "github.com/bflad/tfproviderlint/helper/analysisutils" + "github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcallexpr" + "github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandselectorexpr" +) + +var Analyzer = analysisutils.AvoidSelectorExprAnalyzer( + "XR007", + osexeccommandcallexpr.Analyzer, + osexeccommandselectorexpr.Analyzer, + "os/exec", + "Command", +) diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR008/README.md b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR008/README.md new file mode 100644 index 00000000000..69edac4a6ee --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR008/README.md @@ -0,0 +1,28 @@ +# XR008 + +The XR008 analyzer reports usage of the [`os/exec.CommandContext()`](https://pkg.go.dev/os/exec#CommandContext) function. Providers that are using Go language based SDKs likely want to prevent any execution of other binaries for various reasons such as security and unexpected requirements (e.g. tool installation outside Terraform). + +## Flagged Code + +```go +var sneaky = exec.CommandContext + +sneaky("evilprogram") + +exec.CommandContext("evilprogram") +``` + +## Passing Code + +```go +// Not present :) +``` + +## Ignoring Reports + +Singular reports can be ignored by adding the a `//lintignore:XR008` Go code comment at the end of the offending line or on the line immediately proceding, e.g. + +```go +//lintignore:XR008 +exec.CommandContext("evilprogram") +``` diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR008/XR008.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR008/XR008.go new file mode 100644 index 00000000000..8e970478f47 --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR008/XR008.go @@ -0,0 +1,15 @@ +package XR008 + +import ( + "github.com/bflad/tfproviderlint/helper/analysisutils" + "github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcontextcallexpr" + "github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcontextselectorexpr" +) + +var Analyzer = analysisutils.AvoidSelectorExprAnalyzer( + "XR008", + osexeccommandcontextcallexpr.Analyzer, + osexeccommandcontextselectorexpr.Analyzer, + "os/exec", + "CommandContext", +) diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/checks.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/checks.go index bbd0f03f57e..289fa1cbfa2 100644 --- a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/checks.go +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/checks.go @@ -8,6 +8,8 @@ import ( "github.com/bflad/tfproviderlint/xpasses/XR004" "github.com/bflad/tfproviderlint/xpasses/XR005" "github.com/bflad/tfproviderlint/xpasses/XR006" + "github.com/bflad/tfproviderlint/xpasses/XR007" + "github.com/bflad/tfproviderlint/xpasses/XR008" "github.com/bflad/tfproviderlint/xpasses/XS001" "github.com/bflad/tfproviderlint/xpasses/XS002" "golang.org/x/tools/go/analysis" @@ -24,6 +26,8 @@ var AllChecks = []*analysis.Analyzer{ XR004.Analyzer, XR005.Analyzer, XR006.Analyzer, + XR007.Analyzer, + XR008.Analyzer, XS001.Analyzer, XS002.Analyzer, } diff --git a/awsproviderlint/vendor/modules.txt b/awsproviderlint/vendor/modules.txt index 498d214814e..45dbbb83936 100644 --- a/awsproviderlint/vendor/modules.txt +++ b/awsproviderlint/vendor/modules.txt @@ -68,7 +68,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.24.0 +# github.com/bflad/tfproviderlint v0.26.0 ## explicit github.com/bflad/tfproviderlint/helper/analysisutils github.com/bflad/tfproviderlint/helper/astutils @@ -198,6 +198,10 @@ github.com/bflad/tfproviderlint/passes/helper/validation/validatelistuniquestrin github.com/bflad/tfproviderlint/passes/helper/validation/validateregexpselectorexpr github.com/bflad/tfproviderlint/passes/helper/validation/validaterfc3339timestringselectorexpr github.com/bflad/tfproviderlint/passes/stdlib/fmtsprintfcallexpr +github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcallexpr +github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcontextcallexpr +github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcontextselectorexpr +github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandselectorexpr github.com/bflad/tfproviderlint/passes/stdlib/timesleepcallexpr github.com/bflad/tfproviderlint/passes/testaccfuncdecl github.com/bflad/tfproviderlint/passes/testfuncdecl @@ -209,6 +213,8 @@ github.com/bflad/tfproviderlint/xpasses/XR003 github.com/bflad/tfproviderlint/xpasses/XR004 github.com/bflad/tfproviderlint/xpasses/XR005 github.com/bflad/tfproviderlint/xpasses/XR006 +github.com/bflad/tfproviderlint/xpasses/XR007 +github.com/bflad/tfproviderlint/xpasses/XR008 github.com/bflad/tfproviderlint/xpasses/XS001 github.com/bflad/tfproviderlint/xpasses/XS002 # github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d