commit | 018bec4e5c5fd5fa595155a88e02dbd94144352b | [log] [tgz] |
---|---|---|
author | Sam Saccone <samccone@google.com> | Fri Jul 10 18:51:16 2020 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Fri Jul 10 18:51:16 2020 +0000 |
tree | c23cde41453e9697481fe3452b8d791da9bfba38 | |
parent | eb3132ef434998eb10c06551c5f60e57402bea58 [diff] | |
parent | 55d6ed27a646a95db68a07cfaccffee76c546652 [diff] |
[automerger skipped] Migrate from blame to history scoped blame am: adef809ab8 am: c2fc52cc78 -s ours am: 55d6ed27a6 -s ours am skip reason: Change-Id I2c020aa64264834135f2b17f0c8a4a274bfd13bd with SHA-1 f3179e7578 is in history Original change: https://googleplex-android-review.googlesource.com/c/platform/prebuilts/checkstyle/+/12129282 Change-Id: I5ce021c2d9e8b3e7cd35644847e456bd1a0dacaa
Checkstyle is used by developers to validate Java code style and formatting, and can be run as part of the pre-upload hooks.
It can be invoked in two ways.
checkstyle.py -f FILE [FILE ...]
checkstyle.py
A development tool to help programmers write Java code that adheres to a coding standard.
Git-lint is a tool to run lint checks on only files changed in the latest commit.
To run checkstyle as part of the pre-upload hooks, add the following line to your PREUPLOAD.cfg
:
checkstyle_hook = ${REPO_ROOT}/prebuilts/checkstyle/checkstyle.py --sha ${PREUPLOAD_COMMIT}
Note that checkstyle does not always agree with clang-format, and so it's best to only have one enabled for Java.
In .clang-format
add the following to disable format checking and correcting for Java:
--- Language: Java DisableFormat: true SortIncludes: false ---
In some versions of clang-format, DisableFormat
doesn't stop the sorting of includes. So to fully disable clang-format from doing anything for Java files, both options are needed.