This repository contains code style settings that can be used to ensure formatting consistency inside Java / Gradle projects.
Project is configured to use Spotless with Palantir java format which is based on the Google java format.
Use below command to apply Spotless
code formatting steps
./gradlew spotlessApply
Run spotlessApply
automatically on every commit.
- Install pre-commit
brew install pre-commit
- Open new terminal and go to project directory
- Install pre-commit hook using .pre-commit-config.yaml
pre-commit install
rm ./.git/hooks/pre-commit
A palantir-java-format IntelliJ plugin
is available from the plugin repository. To install it, go to your IDE's settings and select the Plugins
category.
Click the Marketplace
tab, search for the palantir-java-format
plugin, and click the Install
button.
The plugin will be disabled by default on new projects but if using the com.palantir.java-format
gradle plugin, it
will be recommended in IntelliJ and automatically configured.
To manually enable it in the current project, go to File→Settings...→palantir-java-format Settings
(
or IntelliJ IDEA→Preferences...→Other Settings→palantir-java-format Settings
on macOS) and check
the Enable palantir-java-format
checkbox.
When enabled, it will replace the normal Reformat Code
action, which can be triggered from the Code
menu or with the
Ctrl-Alt-L (by default) keyboard shortcut.
Custom codeStyles settings are stored inside this repository and they will be used automatically, in order to ensure correct import orders and other formatting rules inside Intelij IDE.
Distributed under the MIT License. See LICENSE
for more information.