Skip to content

Commit

Permalink
fix: better location reporting in use-if rule
Browse files Browse the repository at this point in the history
Fixes #1361

Signed-off-by: Anders Eknert <[email protected]>
  • Loading branch information
anderseknert committed Jan 23, 2025
1 parent b29ad44 commit 0256563
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bundle/regal/rules/idiomatic/use-if/use_if.rego
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ report contains violation if {

not startswith(text, "if")

violation := result.fail(rego.metadata.chain(), result.location(rule))
violation := result.fail(rego.metadata.chain(), result.ranged_from_ref(rule.head.ref))
}
4 changes: 2 additions & 2 deletions bundle/regal/rules/idiomatic/use-if/use_if_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ test_fail_should_use_if if {
"file": "policy_v0.rego",
"row": 3,
"end": {
"col": 3,
"row": 7,
"col": 5,
"row": 3,
},
"text": "rule := [true |",
},
Expand Down

0 comments on commit 0256563

Please sign in to comment.