-
Notifications
You must be signed in to change notification settings - Fork 134
New feature flag: com.palantir.baseline-format.palantir-java-format=true #936
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
9f5095f
Snapshot tests for palantir-java-format
iamdanfox 235e507
README
iamdanfox 94ceec4
ugh manual formatting
iamdanfox 786f46a
Add generated changelog entries
iamdanfox 25a4f3c
test -Drecreate=true
iamdanfox 930233e
use palantir-java-format
dansanduleac 56b0f42
Merge remote-tracking branch 'origin/develop' into dfox/palantir-java…
iamdanfox bf70033
Update p-j-f tests
iamdanfox 5df5f0f
use new palantir-java-format
dansanduleac 5a370e1
format using the new formatter
dansanduleac 32bc714
set up intellij configuration via gradle-palantir-java-format
dansanduleac f7566b5
actually, should only apply it to the root project
dansanduleac 02c7896
mention plugin URL in readme
dansanduleac File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 @@ | ||
| type: feature | ||
| feature: | ||
| description: Users can opt-in to format their files using our fork of google-java-format | ||
| (palantir-java-format) | ||
| links: | ||
| - https://github.com/palantir/gradle-baseline/pull/936 |
This file contains hidden or 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 hidden or 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 hidden or 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
18 changes: 18 additions & 0 deletions
18
...java/src/test/resources/com/palantir/baseline/palantirjavaformat-expected/BlankLines.java
This file contains hidden or 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; | ||
|
|
||
| public class Test { | ||
| /** | ||
| * Docstring that looks like a list: | ||
| * | ||
| * <p>1. hey 2. there | ||
| * | ||
| * <p>with blank line. | ||
| */ | ||
| Void test() { | ||
| /* | ||
| Normal comment | ||
|
|
||
| with blank line. | ||
| */ | ||
| } | ||
| } |
13 changes: 13 additions & 0 deletions
13
...ne-java/src/test/resources/com/palantir/baseline/palantirjavaformat-expected/Correct.java
This file contains hidden or 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,13 @@ | ||
| package test; | ||
|
|
||
| public class Test { | ||
| void test() { | ||
| int x = 1; | ||
| System.out.println("Hello"); | ||
| Optional.of("hello") | ||
| .orElseGet( | ||
| () -> { | ||
| return "Hello World"; | ||
| }); | ||
| } | ||
| } |
13 changes: 13 additions & 0 deletions
13
...ne-java/src/test/resources/com/palantir/baseline/palantirjavaformat-expected/Invalid.java
This file contains hidden or 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,13 @@ | ||
| package test; | ||
|
|
||
| public class Test { | ||
| void test() { | ||
| int x = 1; | ||
| System.out.println("Hello"); | ||
| Optional.of("hello") | ||
| .orElseGet( | ||
| () -> { | ||
| return "Hello World"; | ||
| }); | ||
| } | ||
| } |
15 changes: 15 additions & 0 deletions
15
...java/src/test/resources/com/palantir/baseline/palantirjavaformat-expected/Multicatch.java
This file contains hidden or 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,15 @@ | ||
| package test; | ||
|
|
||
| class Multicatch { | ||
| void test() { | ||
| try { | ||
| // whatever | ||
| } catch (ClassNotFoundException | ||
| | ClassCastException | ||
| | NoSuchMethodException | ||
| | IllegalAccessException | ||
| | InvocationTargetException e) { | ||
| // ignore | ||
| } | ||
| } | ||
| } |
19 changes: 19 additions & 0 deletions
19
.../resources/com/palantir/baseline/palantirjavaformat-expected/MultilineStringConstant.java
This file contains hidden or 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,19 @@ | ||
| package test; | ||
|
|
||
| class MultilineStringConstant { | ||
|
|
||
| // NON-NLS comments are required for i18n, it's important they are kept with their strings. | ||
| private static final String MULTIPLE_LINE_NON_NLS = | ||
| "field_0," | ||
| + //$NON-NLS-1$ | ||
| "field_1," | ||
| + //$NON-NLS-1$ | ||
| "field_2," | ||
| + //$NON-NLS-1$ | ||
| "field_3," | ||
| + //$NON-NLS-1$ | ||
| "field_4"; //$NON-NLS-1$ | ||
|
|
||
| private static final String MULTIPLE_LINE_NO_COMMENT = | ||
| "field_0," + "field_1," + "field_2," + "field_3," + "field_4"; | ||
| } |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is kinda interesting... I'd prefer to actually put this in a configuration, and resolve it only when the
formattask is called, as this would reduce the amount of stuff necessary for configuration. HOWEVER, I think that would require using a JavaExec task, which I don't want to do as it incurs JVM startup time and heap size sadness.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it won't, Spotless allows you to load a classpath and run it in a different classloader. We could do that instead