diff --git a/bundle/regal/rules/style/prefer-snake-case/prefer_snake_case.rego b/bundle/regal/rules/style/prefer-snake-case/prefer_snake_case.rego index 362c029f..a82f7c0f 100644 --- a/bundle/regal/rules/style/prefer-snake-case/prefer_snake_case.rego +++ b/bundle/regal/rules/style/prefer-snake-case/prefer_snake_case.rego @@ -13,7 +13,7 @@ report contains violation if { some part in ast.named_refs(rule.head.ref) not util.is_snake_case(part.value) - violation := result.fail(rego.metadata.chain(), _location(rule, part)) + violation := result.fail(rego.metadata.chain(), result.ranged_location_from_text(part)) } report contains violation if { @@ -22,9 +22,3 @@ report contains violation if { violation := result.fail(rego.metadata.chain(), result.ranged_location_from_text(var)) } - -_location(_, part) := result.ranged_location_from_text(part) if part.location - -# workaround until https://github.com/open-policy-agent/opa/issues/6860 -# is fixed and we can trust that location is included for all ref parts -_location(rule, part) := result.ranged_location_from_text(rule.head) if not part.location diff --git a/bundle/regal/rules/style/prefer-snake-case/prefer_snake_case_test.rego b/bundle/regal/rules/style/prefer-snake-case/prefer_snake_case_test.rego index 61644033..a4f81cab 100644 --- a/bundle/regal/rules/style/prefer-snake-case/prefer_snake_case_test.rego +++ b/bundle/regal/rules/style/prefer-snake-case/prefer_snake_case_test.rego @@ -164,7 +164,6 @@ test_success_snake_cased_every if { r == set() } -# https://github.com/open-policy-agent/opa/issues/6860 test_fail_location_provided_even_when_not_in_ref if { r := rule.report with input as ast.with_rego_v1(`foo.Bar := true`) r == expected_with_locations([{