Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b3aa7e91 authored by William Escande's avatar William Escande
Browse files

Replace checkstyle with formatter to sort import

Historically, checkstyle was the only one respecting the android style
guide of sorting import.
Since an contribution in 2019, google-java-format does that properly:
https://github.com/google/google-java-format/pull/370/files

Note that checkstyle is now wrong for some import, as libcore is an
android import but checkstyle consider is as third party

The formatter is preferred as it will propose a fix command during the
hook

See style guide:
https://source.android.com/docs/setup/contribute/code-style#order-import-statements

Bug: 343776166
Test: None
Flag: Exempt INFRA
Change-Id: I3505cd15609e159413c0ea68fbcf25ae7c1e8e94
parent 84a74b74
Loading
Loading
Loading
Loading
+8 −12
Original line number Diff line number Diff line
@@ -2,27 +2,23 @@
ignore_merged_commits = true

[Builtin Hooks]
bpfmt = true
clang_format = true
commit_msg_changeid_field = true
commit_msg_bug_field = true
cpplint = true
google_java_format = true
clang_format = true
rustfmt = true
bpfmt = true
ktfmt = true
rustfmt = true

[Builtin Hooks Options]
rustfmt = --config-path=rustfmt.toml
# Only turn on clang-format check for C and C++ headers and sources
bpfmt = -s
clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp,hpp
google_java_format= --sort-imports
ktfmt = --kotlinlang-style
bpfmt = -s
rustfmt = --config-path=rustfmt.toml

[Hook Scripts]
checkstyle_hook = ${REPO_ROOT}/prebuilts/checkstyle/checkstyle.py --sha ${PREUPLOAD_COMMIT}
                  -fw android/app/src/com/android/bluetooth/
                      android/app/lib/mapapi/com/android/bluetooth/mapapi/
                      android/app/tests/src/com/android/bluetooth/
                      framework/
                      service/
aosp_first = ${REPO_ROOT}/frameworks/base/tools/aosp/aosp_sha.sh ${PREUPLOAD_COMMIT} ${PREUPLOAD_FILES}
yapf_hook = ./system/tools/scripts/yapf_checker.py