From 0a9d26cdfae18dd90523133831cde12b8f31d8ac Mon Sep 17 00:00:00 2001 From: Dentrax Date: Mon, 22 Jul 2024 16:37:08 +0300 Subject: [PATCH] set severity to warning Signed-off-by: Dentrax --- pkg/lint/rules.go | 2 +- pkg/lint/rules_test.go | 26 ++++++++++--------- .../version-stream-mismatch-version-1.2.yaml | 3 +++ .../version-stream-missing-provides-1.2.yaml | 3 +++ 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/pkg/lint/rules.go b/pkg/lint/rules.go index 424fb729..8edddd86 100644 --- a/pkg/lint/rules.go +++ b/pkg/lint/rules.go @@ -459,7 +459,7 @@ var AllRules = func(l *Linter) Rules { //nolint:gocyclo { Name: "valid-version-stream", Description: "check the provides and tag filter if version stream suffix is passed to package name", - Severity: SeverityError, + Severity: SeverityWarning, LintFunc: func(c config.Configuration) error { // This regex captures a string that ends with a semantic version (semver) suffix. // It returns two groups: diff --git a/pkg/lint/rules_test.go b/pkg/lint/rules_test.go index 5d1ed6d3..dba0672f 100644 --- a/pkg/lint/rules_test.go +++ b/pkg/lint/rules_test.go @@ -412,19 +412,21 @@ func TestLinter_Rules(t *testing.T) { }, }, }, + wantErr: false, + matches: 1, }, { file: "version-stream-missing-provides-1.2.yaml", - minSeverity: SeverityError, + minSeverity: SeverityWarning, want: EvalResult{ File: "version-stream-missing-provides-1.2", Errors: EvalRuleErrors{ { Rule: Rule{ Name: "valid-version-stream", - Severity: SeverityError, + Severity: SeverityWarning, }, - Error: fmt.Errorf("[valid-version-stream]: package is version streamed but version-stream-missing-provides=${{package.full-version}} is missing on dependencies.provides (ERROR)"), + Error: fmt.Errorf("[valid-version-stream]: package is version streamed but version-stream-missing-provides=${{package.full-version}} is missing on dependencies.provides (WARNING)"), }, }, }, @@ -433,16 +435,16 @@ func TestLinter_Rules(t *testing.T) { }, { file: "version-stream-missing-update-tagfilter-1.2.yaml", - minSeverity: SeverityError, + minSeverity: SeverityWarning, want: EvalResult{ File: "version-stream-missing-update-tagfilter-1.2", Errors: EvalRuleErrors{ { Rule: Rule{ Name: "valid-version-stream", - Severity: SeverityError, + Severity: SeverityWarning, }, - Error: fmt.Errorf("[valid-version-stream]: package is version streamed but tag filter 1.2 is mismatch on update.github (ERROR)"), + Error: fmt.Errorf("[valid-version-stream]: package is version streamed but tag filter 1.2 is mismatch on update.github (WARNING)"), }, }, }, @@ -451,16 +453,16 @@ func TestLinter_Rules(t *testing.T) { }, { file: "version-stream-missing-update-tagfilter-1.2-999.yaml", - minSeverity: SeverityError, + minSeverity: SeverityWarning, want: EvalResult{ File: "version-stream-missing-update-tagfilter-1.2", Errors: EvalRuleErrors{ { Rule: Rule{ Name: "valid-version-stream", - Severity: SeverityError, + Severity: SeverityWarning, }, - Error: fmt.Errorf("[valid-version-stream]: package is version streamed but tag filter 1.2 is mismatch on update.github (ERROR)"), + Error: fmt.Errorf("[valid-version-stream]: package is version streamed but tag filter 1.2 is mismatch on update.github (WARNING)"), }, }, }, @@ -469,16 +471,16 @@ func TestLinter_Rules(t *testing.T) { }, { file: "version-stream-mismatch-version-1.2.yaml", - minSeverity: SeverityError, + minSeverity: SeverityWarning, want: EvalResult{ File: "version-stream-mismatch-version-1.2", Errors: EvalRuleErrors{ { Rule: Rule{ Name: "valid-version-stream", - Severity: SeverityError, + Severity: SeverityWarning, }, - Error: fmt.Errorf("[valid-version-stream]: package is version streamed but package.version 1.7 starts with different than given version stream 1.2 (ERROR)"), + Error: fmt.Errorf("[valid-version-stream]: package is version streamed but package.version 1.7 starts with different than given version stream 1.2 (WARNING)"), }, }, }, diff --git a/pkg/lint/testdata/files/version-stream-mismatch-version-1.2.yaml b/pkg/lint/testdata/files/version-stream-mismatch-version-1.2.yaml index 5164d335..3a495d13 100644 --- a/pkg/lint/testdata/files/version-stream-mismatch-version-1.2.yaml +++ b/pkg/lint/testdata/files/version-stream-mismatch-version-1.2.yaml @@ -13,3 +13,6 @@ pipeline: test: pipeline: - runs: "echo 'test'" + +update: + enabled: true diff --git a/pkg/lint/testdata/files/version-stream-missing-provides-1.2.yaml b/pkg/lint/testdata/files/version-stream-missing-provides-1.2.yaml index 19c81da5..31c1a5f4 100644 --- a/pkg/lint/testdata/files/version-stream-missing-provides-1.2.yaml +++ b/pkg/lint/testdata/files/version-stream-missing-provides-1.2.yaml @@ -13,3 +13,6 @@ pipeline: test: pipeline: - runs: "echo 'test'" + +update: + enabled: true