-
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.
format: keep new lines in between function arguments
This snippet, r = contains( input.x, "y", ) would have been formatted as r = contains(input.x, "y") before. Now, any new lines added between function arguments will be kept, and the snippet will not be reformatted. As a consequence, comments on the separate arguments we OK: r = contains( input.x, # haystack "y", # needle ) and don't freak out the formatter. Fixes #3836. Signed-off-by: Stephan Renatus <[email protected]>
- Loading branch information
Showing
6 changed files
with
56 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package test | ||
|
||
p { | ||
x := count( | ||
[1, 2, 3] # four | ||
) | ||
y := concat( | ||
"/", | ||
["foo", "bar"], | ||
) | ||
z := concat("/", | ||
[ | ||
"foo", | ||
"bar", | ||
]) | ||
} |
18 changes: 18 additions & 0 deletions
18
format/testfiles/test_fun_args_with_linebreaks.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,18 @@ | ||
package test | ||
|
||
p { | ||
x := count([1, 2, 3]) # four | ||
|
||
y := concat( | ||
"/", | ||
["foo", "bar"], | ||
) | ||
|
||
z := concat( | ||
"/", | ||
[ | ||
"foo", | ||
"bar", | ||
], | ||
) | ||
} |
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,6 @@ | ||
package testcase | ||
|
||
rule1 = contains( | ||
"", # first comment | ||
"", # second comment | ||
) |
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,6 @@ | ||
package testcase | ||
|
||
rule1 = contains( | ||
"", # first comment | ||
"", # second comment | ||
) |