-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Whilie it might have been the right call at the time, much have happened in Rego since then. More specifically, the introduction of if
and single line rule bodies makes the extra newline added between each incremental rule feel like it hurts readability more than it helps, as being able to group incremental rules (whether one-liners or not) seems like a pretty good way to make it clear that they belong together.
What I suggest is that this:
allow if user_is_admin
allow if public_resource
allow if user_is_owner
Is kept intact by the formatter, and not turned into:
allow if user_is_admin
allow if public_resource
allow if user_is_owner
While we continue to add an extra newline between different rule declarations, i..e:
allow if user_is_admin
users_is_admin if "admin" in input.user.roles
Still formats to:
allow if user_is_admin
users_is_admin if "admin" in input.user.roles
Note that while the formatter should respect rule "groups", I don't think it should enforce them. If someone prefers to have:
allow if user_is_admin
allow if public_resource
allow if user_is_owner
The formatter should leave it like that.