@@ -18,7 +18,7 @@ test_fail_redundant_existence_check if {
18
18
" category" : " bugs" ,
19
19
" description" : " Redundant existence check" ,
20
20
" level" : " error" ,
21
- " location" : {" col" : 3 , " file" : " policy.rego" , " row" : 7 , " text" : " \t\t input.foo" },
21
+ " location" : {" col" : 3 , " file" : " policy.rego" , " row" : 7 , " text" : " \t\t input.foo" , " end " : { " col " : 12 , " row " : 7 } },
22
22
" related_resources" : [{
23
23
" description" : " documentation" ,
24
24
" ref" : config.docs.resolve_url (" $baseUrl/$category/redundant-existence-check" , " bugs" ),
@@ -47,3 +47,22 @@ test_success_not_redundant_existence_check_with_cancels if {
47
47
r := rule.report with input as module
48
48
r == set ()
49
49
}
50
+
51
+ test_fail_redundant_existence_check_head_assignment_of_ref if {
52
+ module := ast.with_rego_v1 (`
53
+ redundant := input.foo if {
54
+ input.foo
55
+ }` )
56
+ r := rule.report with input as module
57
+ r == {{
58
+ " category" : " bugs" ,
59
+ " description" : " Redundant existence check" ,
60
+ " level" : " error" ,
61
+ " location" : {" col" : 3 , " file" : " policy.rego" , " row" : 7 , " text" : " \t\t input.foo" , " end" : {" col" : 12 , " row" : 7 }},
62
+ " related_resources" : [{
63
+ " description" : " documentation" ,
64
+ " ref" : config.docs.resolve_url (" $baseUrl/$category/redundant-existence-check" , " bugs" ),
65
+ }],
66
+ " title" : " redundant-existence-check" ,
67
+ }}
68
+ }
0 commit comments