commit | af2b26618903b21634b8e5171eed2c5d9ee71adc | [log] [tgz] |
---|---|---|
author | Xin Li <delphij@google.com> | Mon Jan 29 10:26:40 2024 -0800 |
committer | Xin Li <delphij@google.com> | Mon Jan 29 10:26:40 2024 -0800 |
tree | 6916efbbe808ca3ae40325a702bb917899406514 | |
parent | 44608070ecf0de5cc3704749acef2f39969a45a2 [diff] | |
parent | 250ec5d992e5fda3be2e2eedb4f1b7e34ea17605 [diff] |
Merge Android 24Q1 Release (ab/11220357) Bug: 319669529 Merged-In: I1350ab5448f1d05b40a8a4a791e3e7227364c883 Change-Id: I58f5168509ea64b24f5c17f4024fcdaa04050e5a
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.