-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating formatter to not drop
rego.v1
and future.keywords
imports (
#7224) to maximize compatibility surface across OPA versions. Adding `--drop-v0-imports` flag to `opa fmt` for opting in to dropping redundant v0 imports. Signed-off-by: Johan Fylling <[email protected]>
- Loading branch information
1 parent
ba028b5
commit f883062
Showing
8 changed files
with
192 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package p | ||
|
||
# existing future.keywords imports kept for broadest compatibility surface | ||
import future.keywords.every | ||
import future.keywords.if | ||
|
||
r if { | ||
every x in [1,3,5] { | ||
is_odd(x) | ||
} | ||
|
||
every x in [1,3,5] { is_odd(x); true } | ||
|
||
every x in [1,3,5] { | ||
is_odd(x) | ||
true | ||
x < 10 | ||
} | ||
} | ||
|
||
is_odd(x) = x % 2 == 0 |
21 changes: 21 additions & 0 deletions
21
v1/format/testfiles/v1/test_future_kw_import.rego.formatted
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package p | ||
|
||
# existing future.keywords imports kept for broadest compatibility surface | ||
import future.keywords.every | ||
import future.keywords.if | ||
|
||
r if { | ||
every x in [1, 3, 5] { | ||
is_odd(x) | ||
} | ||
|
||
every x in [1, 3, 5] { is_odd(x); true} | ||
|
||
every x in [1, 3, 5] { | ||
is_odd(x) | ||
true | ||
x < 10 | ||
} | ||
} | ||
|
||
is_odd(x) := (x % 2) == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters