Skip to content
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
4 changes: 2 additions & 2 deletions pkg/merger/merger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func TestMergeConfigFiles(t *testing.T) {
EnablePullRequestReviews: models.Bool(true),
EnableIssueDashboards: models.Bool(true),
SeverityThreshold: models.SeverityHigh,
PriorityThreshold: models.PriorityMedium,
PriorityThreshold: models.PriorityImportant,
IgnoreDirs: []string{"dir1", "dir2"},
IgnorePaths: []string{"path1", "path2"},
Code: models.Code{
Expand Down Expand Up @@ -235,7 +235,7 @@ func TestMergeConfigFiles(t *testing.T) {
EnablePullRequestReviews: models.Bool(true),
EnableIssueDashboards: models.Bool(true),
SeverityThreshold: models.SeverityHigh,
PriorityThreshold: models.PriorityMedium,
PriorityThreshold: models.PriorityImportant,
IgnoreDirs: []string{"dir1", "dir2"},
IgnorePaths: []string{"path1", "path2"},
Code: models.Code{
Expand Down
8 changes: 3 additions & 5 deletions pkg/models/priority.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package models

const (
PriorityUrgent string = "URGENT"
PriorityImportant string = "IMPORTANT"
PriorityMedium string = "MEDIUM"
PriorityLow string = "LOW"
PriorityNegligible string = "NEGLIGIBLE"
PriorityUrgent string = "URGENT"
PriorityImportant string = "IMPORTANT"
PriorityInformational string = "INFORMATIONAL"
)
2 changes: 1 addition & 1 deletion pkg/parser/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package parser
import "github.com/nullify-platform/config-file-parser/pkg/models"

const DefaultSeverityThreshold = models.SeverityMedium
const DefaultPriorityThreshold = models.PriorityMedium
const DefaultPriorityThreshold = models.PriorityImportant

func NewDefaultConfig() *models.Configuration {
return &models.Configuration{
Expand Down
5 changes: 5 additions & 0 deletions pkg/parser/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ func sanitizeConfig(config *models.Configuration) {
config.SeverityThreshold = strings.ToUpper(config.SeverityThreshold)
}

config.PriorityThreshold = strings.Trim(config.PriorityThreshold, " ")
if config.PriorityThreshold != "" {
config.PriorityThreshold = strings.ToUpper(config.PriorityThreshold)
}

for name, n := range config.Notifications {
if n.Events.All != nil {
n.Events.All.MinimumSeverity = strings.ToUpper(n.Events.All.MinimumSeverity)
Expand Down
4 changes: 1 addition & 3 deletions pkg/validator/severity.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ var validPriorities = []string{
"",
models.PriorityUrgent,
models.PriorityImportant,
models.PriorityMedium,
models.PriorityLow,
models.PriorityNegligible,
models.PriorityInformational,
}

// ValidatePriorityThreshold returns true if the priority_threshold
Expand Down
1 change: 1 addition & 0 deletions tests/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ func TestIntegration(t *testing.T) {
EnablePullRequestReviews: models.Bool(true),
EnableIssueDashboards: models.Bool(true),
SeverityThreshold: models.SeverityMedium,
PriorityThreshold: models.PriorityUrgent,
IgnoreDirs: []string{"dir1"},
IgnorePaths: []string{"data/**/*"},
Secrets: models.Secrets{
Expand Down
1 change: 1 addition & 0 deletions tests/nullify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ enable_fail_builds: true
enable_pull_request_reviews: true
enable_issue_dashboards: true
severity_threshold: medium
priority_threshold: urgent
ignore_dirs:
- dir1
ignore_paths:
Expand Down
Loading