tag | 77955a32db52890ac319acc60b4e379a67605509 | |
---|---|---|
tagger | The Android Open Source Project <initial-contribution@android.com> | Mon Mar 18 13:06:15 2024 -0700 |
object | 45d51aadf2c8b2847b054fbb3080b30cb71470e7 |
ub-automotive-master-20240314 (11578649)
commit | 45d51aadf2c8b2847b054fbb3080b30cb71470e7 | [log] [tgz] |
---|---|---|
author | Austin Foxley <afoxley@google.com> | Fri Mar 08 20:38:42 2024 +0000 |
committer | Austin Foxley <afoxley@google.com> | Fri Mar 08 20:38:42 2024 +0000 |
tree | 2ba818d65ede16ca7ee2c199203c72d7b16a3ffc | |
parent | 41bc20c514abd07524e6490d2dc521f8ca58e692 [diff] |
checkstyle: Fix disagreement between checkstyle and google-java-format If there is an import starting with 'vendor', google-java-format expects it to appear before the 'java' group. Update config to match. Bug: b/328800452 Test: checkstyle no longer complains about google-java-format'd code Change-Id: I48725b37b99bff3eb209b60520cd99b0b0ac2fed
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.