commit | 4e1556aac5a54cf416b62caeb88f70a28e9acfa7 | [log] [tgz] |
---|---|---|
author | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Fri Jul 10 19:20:25 2020 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Fri Jul 10 19:20:25 2020 +0000 |
tree | c23cde41453e9697481fe3452b8d791da9bfba38 | |
parent | 21c498089bfe1a307f74330ea2e37bde6eecc728 [diff] | |
parent | 659e2dff8be18825541e36faa979bfbb6edaf5d8 [diff] |
[automerger skipped] Merge changes from topic "am-8ea55e01c00f43ab9a04f95d6999da61" into rvc-d1-dev-plus-aosp am: a7bef820d9 -s ours am: 3182bd6463 -s ours am: 659e2dff8b -s ours am skip reason: Change-Id I2c020aa64264834135f2b17f0c8a4a274bfd13bd with SHA-1 adef809ab8 is in history Original change: https://googleplex-android-review.googlesource.com/c/platform/prebuilts/checkstyle/+/12129282 Change-Id: If8a35a60c44b1dcd3c49591fcb90704758e860a8
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.