1.9 KiB
1.9 KiB
Code Style
Configure Java Style for IntelliJ
First, download the style configuration.
curl https://raw.githubusercontent.com/google/styleguide/gh-pages/intellij-java-google-style.xml -o ~/Downloads/intellij-java-google-style.xml
Install it in IntelliJ:
- Go to
Preferences > Editor > Code Style - Press the little cog:
Import Scheme > IntelliJ IDEA code style XML- Select the file we just downloaded
- Select
GoogleStylein the dropdown - Change default
Hard wrap atinWrapping and Bracestab to 150 - Airbyte prefers to have explicit imports (e.g.
import foo.bar.ClassNameoverimport foo.bar.*. This can be set by going toPreferences > Code Style > Java > Importsand changingClass count to use import with '*'to9999andNames count to use static import with '\*'to9999 - Add the
finalkeyword wherever possible. You can either set this as the default for your IDE or you can set it just for the Airbyte project(s) that you are using- Turn on the inspection. Go into
Preferences > Editor > Inspections- Search
"Field may be 'final'"> check the box - Search
"local variable or parameter can be 'final'"> check the box - Apply the changes
- Search
- Turn on the auto add final. Go into IntelliJ Preferences
- Plugins - install Save Actions if not already installed
- Go to Save Actions in the preferences left navigation column (NOT Tools > Actions on Save -- that is a different tool)
Activate save actions on save> check the boxActive save actions on shortcut> check the boxActivate save actions on batch> check the boxAdd final modifier to field> check the boxAdd final modifier to local variable or parameter> check the box- Apply the changes
- Turn on the inspection. Go into
- You're done!