-
Notifications
You must be signed in to change notification settings - Fork 5k
Code Formatting
Jan S edited this page May 15, 2019
·
6 revisions
To check and force use one code style Jadx uses checkstyle and spotless with Eclipse formatter. These tools work in tandem and help maintain same code style using config which can be used in all IDEs or from command line.
Here I will give only short description to get started:
- spotless - a gradle plugin checks formatting by reformatting all code and fail build it diff exists.
For format code spotless use Eclipse formatter using config located in
config/code-formatter
. In Eclipse these files can be just imported. In Idea Eclipse formatter plugin can be used. Also, all code can be reformated with:gradle spotlessApply
- checkstyle - check other code style issues like unused imports, bad naming, etc.
Config located in
config/checkstyle
folder. Many IDEs have plugins to run checkstyle on the fly.
All these checks can be executed with gradle check -x test
and also will be executed on build (gradle build
).
So before pushing commit anyone can run:
gradle spotlessApply
gradle check -x test
Then fix all issue and run these command again until all checks passed.