Skip to content

Commit 7e0a400

Browse files
authored
feat(ENT-923): update priority threshold in config file parser (#170)
1 parent 32e6f67 commit 7e0a400

File tree

7 files changed

+14
-11
lines changed

7 files changed

+14
-11
lines changed

pkg/merger/merger_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func TestMergeConfigFiles(t *testing.T) {
9696
EnablePullRequestReviews: models.Bool(true),
9797
EnableIssueDashboards: models.Bool(true),
9898
SeverityThreshold: models.SeverityHigh,
99-
PriorityThreshold: models.PriorityMedium,
99+
PriorityThreshold: models.PriorityImportant,
100100
IgnoreDirs: []string{"dir1", "dir2"},
101101
IgnorePaths: []string{"path1", "path2"},
102102
Code: models.Code{
@@ -235,7 +235,7 @@ func TestMergeConfigFiles(t *testing.T) {
235235
EnablePullRequestReviews: models.Bool(true),
236236
EnableIssueDashboards: models.Bool(true),
237237
SeverityThreshold: models.SeverityHigh,
238-
PriorityThreshold: models.PriorityMedium,
238+
PriorityThreshold: models.PriorityImportant,
239239
IgnoreDirs: []string{"dir1", "dir2"},
240240
IgnorePaths: []string{"path1", "path2"},
241241
Code: models.Code{

pkg/models/priority.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package models
22

33
const (
4-
PriorityUrgent string = "URGENT"
5-
PriorityImportant string = "IMPORTANT"
6-
PriorityMedium string = "MEDIUM"
7-
PriorityLow string = "LOW"
8-
PriorityNegligible string = "NEGLIGIBLE"
4+
PriorityUrgent string = "URGENT"
5+
PriorityImportant string = "IMPORTANT"
6+
PriorityInformational string = "INFORMATIONAL"
97
)

pkg/parser/defaults.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package parser
33
import "github.com/nullify-platform/config-file-parser/pkg/models"
44

55
const DefaultSeverityThreshold = models.SeverityMedium
6-
const DefaultPriorityThreshold = models.PriorityMedium
6+
const DefaultPriorityThreshold = models.PriorityImportant
77

88
func NewDefaultConfig() *models.Configuration {
99
return &models.Configuration{

pkg/parser/parse.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ func sanitizeConfig(config *models.Configuration) {
2525
config.SeverityThreshold = strings.ToUpper(config.SeverityThreshold)
2626
}
2727

28+
config.PriorityThreshold = strings.Trim(config.PriorityThreshold, " ")
29+
if config.PriorityThreshold != "" {
30+
config.PriorityThreshold = strings.ToUpper(config.PriorityThreshold)
31+
}
32+
2833
for name, n := range config.Notifications {
2934
if n.Events.All != nil {
3035
n.Events.All.MinimumSeverity = strings.ToUpper(n.Events.All.MinimumSeverity)

pkg/validator/severity.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ var validPriorities = []string{
2828
"",
2929
models.PriorityUrgent,
3030
models.PriorityImportant,
31-
models.PriorityMedium,
32-
models.PriorityLow,
33-
models.PriorityNegligible,
31+
models.PriorityInformational,
3432
}
3533

3634
// ValidatePriorityThreshold returns true if the priority_threshold

tests/integration_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ func TestIntegration(t *testing.T) {
1515
EnablePullRequestReviews: models.Bool(true),
1616
EnableIssueDashboards: models.Bool(true),
1717
SeverityThreshold: models.SeverityMedium,
18+
PriorityThreshold: models.PriorityUrgent,
1819
IgnoreDirs: []string{"dir1"},
1920
IgnorePaths: []string{"data/**/*"},
2021
Secrets: models.Secrets{

tests/nullify.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ enable_fail_builds: true
22
enable_pull_request_reviews: true
33
enable_issue_dashboards: true
44
severity_threshold: medium
5+
priority_threshold: urgent
56
ignore_dirs:
67
- dir1
78
ignore_paths:

0 commit comments

Comments
 (0)