You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Enforce the Palantir Java Style, whose main difference compared to Google's style is that we use 120 character lines and 4 space indent.
12
+
It is based on the excellent [google-java-format](https://github.com/google/google-java-format), and benefits from the work of all the [original authors](https://github.com/google/google-java-format/graphs/contributors). palantir-java-format is available under the same [Apache 2.0 License](./LICENSE).
13
13
14
-
* Produce more compact code - Keep long method chains and invocations, as well as assignments and lambdas, on a single line, if we can break only the last argument of a method call, or the last method call in a chain.
14
+
## Upsides of automatic formatting
15
15
16
-
* don't break [NON-NLS markers][] - these are comments that are used when implementing NLS internationalisation, and need to stay on the same line with the strings they come after.
16
+
- reduce 'nit' comments in code reviews, allowing engineers to focus on the important logic rather than bikeshedding about whitespace
17
+
- bot-authored code changes can be auto-formatted to a highly readable style (we use [refaster](https://errorprone.info/docs/refaster) and [error-prone](https://errorprone.info/docs/patching) heavily)
18
+
- increased consistency across all repos, so contributing to other projects feels familiar
19
+
- reduce the number builds that trivially fail checkstyle
20
+
- easier to onboard new devs
17
21
18
-
We thank everyone who's worked on google-java-format for their good work and for making it available for free online. It's thanks to their work that we could incorporate our coding style preferences into a formatter so easily.
A pre-commit (pre-commit.com) hook that will automatically run GJF whenever
93
-
you commit code to your repository
94
-
95
-
### as a library
96
-
97
-
The formatter can be used in software which generates java to output more
98
-
legible java code. Just include the library in your maven/gradle/etc.
99
-
configuration.
100
-
101
-
#### Maven
102
-
103
-
```xml
104
-
<dependency>
105
-
<groupId>com.palantir.javaformat</groupId>
106
-
<artifactId>palantir-java-format</artifactId>
107
-
</dependency>
108
-
```
122
+
## Future works
109
123
110
-
#### Gradle
124
+
-[ ] preserve [NON-NLS markers][] - these are comments that are used when implementing NLS internationalisation, and need to stay on the same line with the strings they come after.
0 commit comments