commit | c354fa6c87fb8d4b9f1a90d4dd31a2505cf08c33 | [log] [tgz] |
---|---|---|
author | Xin Li <delphij@google.com> | Tue Apr 30 02:10:29 2024 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Tue Apr 30 02:10:29 2024 +0000 |
tree | 155230ea8546c495dc76833b84e04962c698270b | |
parent | 412954fb3de120c0eea0a42e717dd86fef9ac5d2 [diff] | |
parent | 0cb2b61e504926ec1c14043b3275f5433b4c1a45 [diff] |
[automerger skipped] Empty merge of Android 24Q2 Release (ab/11526283) to aosp-main-future am: 0cb2b61e50 -s ours am skip reason: Merged-In I58fa0ebf949378b1b25434300298588bb969d80d with SHA-1 a6a08173f0 is already in history Original change: https://googleplex-android-review.googlesource.com/c/platform/prebuilts/checkstyle/+/27145103 Change-Id: I2a71f2a44b052dfc6024021b3a668d8f5ef8e357 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
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.