StyraInc / regal

Regal is a linter for Rego, with the goal of making your Rego magnificent!

Home Page:https://docs.styra.com/regal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add function args check to `redundant-existence-check`

anderseknert opened this issue · comments

fun(x) if {
    x
    # do more things
}

x can't be undefined in that location, as if it is, fun isn't going to be called in the first place. We should add this condition to the redundant-existence-check rule.

fun(false) would make a difference, though. 🤔

Hmm, yeah, I guess you're right. We could recommend doing an explicit check for x == true I guess?
Or we could just leave it be.

fun("whatever") would also work; so I guess the explicit check would need to be x != false.

Or we could just leave it be.

I'd be in favor of that. 😎

Hmm, surely "whatever" wouldn't pass as x == true? :)

But either way, I'll concede that this is probably better to leave as it is. One issue less to deal with 🙂