Skip to content

Commit

Permalink
Add linter success message (#2274)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThorstenHans authored Aug 2, 2022
1 parent da2106d commit afcd5de
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions pkg/porter/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ func (p *Porter) PrintLintResults(ctx context.Context, opts LintOptions) error {
return err
}

if !results.HasError() {
fmt.Fprintln(p.Out, "✨ Bundle validation was successful!")
return nil
}

switch opts.Format {
case printer.FormatPlaintext:
fmt.Fprintln(p.Out, results.String())
Expand Down
8 changes: 5 additions & 3 deletions pkg/porter/lint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,11 @@ exec:
testcases := []struct {
format string
wantOutputFile string
linterResults linter.Results
}{
{"plaintext", "testdata/lint/results.txt"},
{"json", "testdata/lint/results.json"},
{"plaintext", "testdata/lint/results.txt", lintResults},
{"json", "testdata/lint/results.json", lintResults},
{"plaintext", "testdata/lint/success.txt", linter.Results{}},
}
for _, tc := range testcases {
t.Run(tc.format, func(t *testing.T) {
Expand All @@ -105,7 +107,7 @@ exec:
p.TestConfig.TestContext.AddTestFile("testdata/porter.yaml", "porter.yaml")

mixins := p.Mixins.(*mixin.TestMixinProvider)
mixins.LintResults = lintResults
mixins.LintResults = tc.linterResults

var opts LintOptions
opts.RawFormat = tc.format
Expand Down
1 change: 1 addition & 0 deletions pkg/porter/testdata/lint/success.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
✨ Bundle validation was successful!

0 comments on commit afcd5de

Please sign in to comment.