We use the IntelliJ Save Action plugin to format the code on save, organize imports and methods.
Follow these instructions to install it:
- Go to File > Settings > Plugins.
- Search for plugin “Save Actions” and click install.
- Search for “Save Actions” in the panel Settings and configure it as follows:
https://plugins.jetbrains.com/plugin/7642-save-actions
We follow the Google Java code style and the best way to adhere it is using the IntelliJ automatic formatter. To accomplish this we need to configure the code style in IntelliJ using the google xml code style configuration file.
You can find the xml file here https://github.com/google/styleguide/blob/gh-pages/intellij-java-google-style.xml
And follow these instructions to import it:
- Download the .xml.
- Go to File > Settings > Editor > Code style.
- Import the .xml:
- Go to the Java section and change the indent size to 4.
A linter is a tool that can be used to analyze source code and flag errors, bugs, style errors, etc. SonarLint is a plugin for IntelliJ that exists with this purpose. In order to configure it, follow these instructions:
- Go to File > Settings > Plugins.
- Search for plugin "Sonarlint" and select "Browse repositories". The following screen will appear:
The tool will be automatically configured in IntelliJ. When writing code, some problematic sections will be highlighted and the tool will provide suggestions to fix the potential bugs.
The tool can be customized by changing highlight colors if desired. To do this go to File > Settings SonarLint:




