Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): Bump github.com/terraform-linters/tflint-ruleset-aws from 0.4.1 to 0.4.3 #1148

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 30 additions & 25 deletions formatter/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,63 +8,68 @@ import (
"github.com/terraform-linters/tflint/tflint"
)

type jsonIssue struct {
Rule jsonRule `json:"rule"`
// JSONIssue is a temporary structure for converting TFLint issues to JSON.
type JSONIssue struct {
Rule JSONRule `json:"rule"`
Message string `json:"message"`
Range jsonRange `json:"range"`
Callers []jsonRange `json:"callers"`
Range JSONRange `json:"range"`
Callers []JSONRange `json:"callers"`
}

type jsonRule struct {
// JSONRule is a temporary structure for converting TFLint rules to JSON.
type JSONRule struct {
Name string `json:"name"`
Severity string `json:"severity"`
Link string `json:"link"`
}

type jsonRange struct {
// JSONRange is a temporary structure for converting ranges to JSON.
type JSONRange struct {
Filename string `json:"filename"`
Start jsonPos `json:"start"`
End jsonPos `json:"end"`
Start JSONPos `json:"start"`
End JSONPos `json:"end"`
}

type jsonPos struct {
// JSONPos is a temporary structure for converting positions to JSON.
type JSONPos struct {
Line int `json:"line"`
Column int `json:"column"`
}

type jsonError struct {
// JSONError is a temporary structure for converting TFLint errors to JSON.
type JSONError struct {
Message string `json:"message"`
}

// JSONOutput is a temporary structure for converting to JSON
// JSONOutput is a temporary structure for converting to JSON.
type JSONOutput struct {
Issues []jsonIssue `json:"issues"`
Errors []jsonError `json:"errors"`
Issues []JSONIssue `json:"issues"`
Errors []JSONError `json:"errors"`
}

func (f *Formatter) jsonPrint(issues tflint.Issues, tferr *tflint.Error) {
ret := &JSONOutput{Issues: make([]jsonIssue, len(issues)), Errors: []jsonError{}}
ret := &JSONOutput{Issues: make([]JSONIssue, len(issues)), Errors: []JSONError{}}

for idx, issue := range issues.Sort() {
ret.Issues[idx] = jsonIssue{
Rule: jsonRule{
ret.Issues[idx] = JSONIssue{
Rule: JSONRule{
Name: issue.Rule.Name(),
Severity: toSeverity(issue.Rule.Severity()),
Link: issue.Rule.Link(),
},
Message: issue.Message,
Range: jsonRange{
Range: JSONRange{
Filename: issue.Range.Filename,
Start: jsonPos{Line: issue.Range.Start.Line, Column: issue.Range.Start.Column},
End: jsonPos{Line: issue.Range.End.Line, Column: issue.Range.End.Column},
Start: JSONPos{Line: issue.Range.Start.Line, Column: issue.Range.Start.Column},
End: JSONPos{Line: issue.Range.End.Line, Column: issue.Range.End.Column},
},
Callers: make([]jsonRange, len(issue.Callers)),
Callers: make([]JSONRange, len(issue.Callers)),
}
for i, caller := range issue.Callers {
ret.Issues[idx].Callers[i] = jsonRange{
ret.Issues[idx].Callers[i] = JSONRange{
Filename: caller.Filename,
Start: jsonPos{Line: caller.Start.Line, Column: caller.Start.Column},
End: jsonPos{Line: caller.End.Line, Column: caller.End.Column},
Start: JSONPos{Line: caller.Start.Line, Column: caller.Start.Column},
End: JSONPos{Line: caller.End.Line, Column: caller.End.Column},
}
}
}
Expand All @@ -77,9 +82,9 @@ func (f *Formatter) jsonPrint(issues tflint.Issues, tferr *tflint.Error) {
errs = []error{tferr.Cause}
}

ret.Errors = make([]jsonError, len(errs))
ret.Errors = make([]JSONError, len(errs))
for idx, err := range errs {
ret.Errors[idx] = jsonError{Message: err.Error()}
ret.Errors[idx] = JSONError{Message: err.Error()}
}
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ require (
github.com/sourcegraph/jsonrpc2 v0.0.0-20190106185902-35a74f039c6a
github.com/spf13/afero v1.2.2 // matches version used by terraform
github.com/terraform-linters/tflint-plugin-sdk v0.8.3-0.20210614125323-8364139f3745
github.com/terraform-linters/tflint-ruleset-aws v0.4.1
github.com/terraform-linters/tflint-ruleset-aws v0.4.3
github.com/zclconf/go-cty v1.8.4
github.com/zclconf/go-cty-yaml v1.0.2
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/terraform-linters/tflint-plugin-sdk v0.8.2/go.mod h1:UsVDOw0Urg0POULWugZ6XFzWJ6i0NaTFYtlYrQe4Auw=
github.com/terraform-linters/tflint-plugin-sdk v0.8.3-0.20210614125323-8364139f3745 h1:Pfug/EdNJFp82PJh1EjOCrF4sXIR+MA/K5Xsgdja2Ek=
github.com/terraform-linters/tflint-plugin-sdk v0.8.3-0.20210614125323-8364139f3745/go.mod h1:UsVDOw0Urg0POULWugZ6XFzWJ6i0NaTFYtlYrQe4Auw=
github.com/terraform-linters/tflint-ruleset-aws v0.4.1 h1:g+c6nrHl09W2RmSbEZG4UtIVKVknERHPTMQysukuTsk=
github.com/terraform-linters/tflint-ruleset-aws v0.4.1/go.mod h1:OoFdm8gUCOiKHlhvZQ1/r8EhGF75aYUM/URrBFjIXus=
github.com/terraform-linters/tflint-ruleset-aws v0.4.3 h1:qpRwmVlJNz2UwWwDz2MxyetXIBDuTBiq+j9kzi82l3Q=
github.com/terraform-linters/tflint-ruleset-aws v0.4.3/go.mod h1:OoFdm8gUCOiKHlhvZQ1/r8EhGF75aYUM/URrBFjIXus=
github.com/terraform-providers/terraform-provider-aws v1.60.1-0.20210603220658-c16ad68fc0b6/go.mod h1:9t9ETRrldqJ/AI5x4zJYywM0ykXJR2PmaSj/ir0lJjY=
github.com/ulikunitz/xz v0.5.8 h1:ERv8V6GKqVi23rgu5cj9pVfVzJbOqAY2Ntl88O6c2nQ=
github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
Expand Down
6 changes: 5 additions & 1 deletion integrationtest/bundled/bundled_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"testing"

"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/terraform-linters/tflint/formatter"
)

Expand Down Expand Up @@ -125,7 +126,10 @@ func TestBundledPlugin(t *testing.T) {
t.Fatal(err)
}

if !cmp.Equal(got, expected) {
opts := []cmp.Option{
cmpopts.IgnoreFields(formatter.JSONRule{}, "Link"),
}
if !cmp.Equal(got, expected, opts...) {
t.Fatalf("Failed `%s` test: diff=%s", tc.Name, cmp.Diff(expected, got))
}
}
Expand Down