-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for specifying formatter config (#235)
Signed-off-by: Felix Zheng <[email protected]>
- Loading branch information
1 parent
0acff8a
commit 80f8077
Showing
8 changed files
with
117 additions
and
5 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
22 changes: 22 additions & 0 deletions
22
CedarJava/src/main/java/com/cedarpolicy/model/formatter/Config.java
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,22 @@ | ||
package com.cedarpolicy.model.formatter; | ||
|
||
public class Config { | ||
|
||
private final int lineWidth; | ||
private final int indentWidth; | ||
|
||
public Config(int lineWidth, int indentWidth) { | ||
this.lineWidth = lineWidth; | ||
this.indentWidth = indentWidth; | ||
} | ||
|
||
@SuppressWarnings("unused") | ||
public int getLineWidth() { | ||
return lineWidth; | ||
} | ||
|
||
@SuppressWarnings("unused") | ||
public int getIndentWidth() { | ||
return indentWidth; | ||
} | ||
} |
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
6 changes: 6 additions & 0 deletions
6
CedarJava/src/test/resources/formatted_policy_custom_config.cedar
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 @@ | ||
permit ( | ||
principal, | ||
action == Action::"update", | ||
resource | ||
) | ||
when { resource.owner == principal }; |
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 |
---|---|---|
|
@@ -10,4 +10,4 @@ forbid ( | |
principal == User::"Liam", | ||
action, | ||
resource = Photo::"Husky.jpg" | ||
); | ||
); |
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