Open anderseknert opened 1 year ago
One idea would be to group violations either by rule, or by file. If we currently have an output like this:
Rule: forbidden-function-call
Description: Forbidden function call
Category: custom
Location: p.rego:4:4
Text: 1 > input.x
Documentation: https://docs.styra.com/regal/rules/custom/forbidden-function-call
Rule: forbidden-function-call
Description: Forbidden function call
Category: custom
Location: p.rego:5:4
Text: 1 < input.x
Documentation: https://docs.styra.com/regal/rules/custom/forbidden-function-call
Rule: forbidden-function-call
Description: Forbidden function call
Category: custom
Location: p.rego:6:4
Text: 1 >= input.x
Documentation: https://docs.styra.com/regal/rules/custom/forbidden-function-call
Rule: forbidden-function-call
Description: Forbidden function call
Category: custom
Location: p.rego:7:4
Text: 1 <= input.x
Documentation: https://docs.styra.com/regal/rules/custom/forbidden-function-call
We could present it as:
Rule: forbidden-function-call
Description: Forbidden function call
Category: custom
Documentation: https://docs.styra.com/regal/rules/custom/forbidden-function-call
Locations: p.rego:4:4 1 > input.x
p.rego:5:4 1 < input.x
p.rego:6:4 1 >= input.x
p.rego:7:4 1 <= input.x
Or something like that. Not sure how we'd best deal with long paths though. Perhaps just one line for the location, and one for the text. It would still save a lot of space compared to listing each violation separately. Maybe listing each location/text separately would be best:
Rule: forbidden-function-call
Description: Forbidden function call
Category: custom
Documentation: https://docs.styra.com/regal/rules/custom/forbidden-function-call
Location: p.rego:4:4
Text: 1 > input.x
Location: p.rego:5:4
Text: 1 < input.x
Location: p.rego:6:4
Text: 1 >= input.x
Location: p.rego:7:4
Text: 1 <= input.x
@anderseknert Could you please assign this to me ?
@rahulkrishnanfs done!
Thanks @anderseknert
@rahulkrishnanfs did you find some time to take a look at this? 🙂
Or whatever number makes the most sense. When there are hundreds of violations, it's not a great experience having to scroll over several pages to see them, and even the "compact" view is currently quite dense. It would be nice if we counted the number of violations, and presented an aggregated report grouped by category/rule, and a list of locations.