Skip to content

Commit

Permalink
Don't mark manual rules without Rego as missing (#77)
Browse files Browse the repository at this point in the history
* Don't mark manual rules without Rego as missing

Signed-off-by: wwwil <wwwil.squires@gmail.com>

* Add manual rule to TestNewReport

Signed-off-by: wwwil <wwwil.squires@gmail.com>
  • Loading branch information
wwwil authored Feb 5, 2020
1 parent 0098447 commit 33cfa96
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/reports/reports.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,10 @@ func NewReport(pm *packaging.PolicyManifest, rc *results.ResultCollection) (api.

switch {
case result == nil:
missing = true
missingRules = append(missingRules, rule.ID)
if !rule.Manual {
missing = true
missingRules = append(missingRules, rule.ID)
}
case result.IsFailureState():
success = false
violations = result.Violations
Expand Down
23 changes: 23 additions & 0 deletions pkg/reports/reports_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ func TestNewReport(t *testing.T) {
ID: "b_rule",
Name: "My Rule B",
},
{
ID: "c_rule",
Name: "My Rule C",
Manual: true,
},
},
},
},
Expand Down Expand Up @@ -295,6 +300,15 @@ func TestNewReport(t *testing.T) {
Links: []string{},
Violations: []string{"violation"},
},
api.ReportRule{
ID: "c_rule",
Name: "My Rule C",
Manual: true,
Success: false,
Missing: false,
Links: []string{},
Violations: []string{},
},
},
},
},
Expand Down Expand Up @@ -349,6 +363,15 @@ func TestNewReport(t *testing.T) {
Links: []string{},
Violations: []string{},
},
api.ReportRule{
ID: "c_rule",
Name: "My Rule C",
Manual: true,
Success: false,
Missing: false,
Links: []string{},
Violations: []string{},
},
},
},
},
Expand Down

0 comments on commit 33cfa96

Please sign in to comment.