summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Siarhei Vishniakou <svv@google.com> 2019-12-09 16:08:46 -0800
committer Siarhei Vishniakou <svv@google.com> 2019-12-10 10:15:27 -0800
commita3117ca4c67b1bad76c62d90732e28bcbe6c5489 (patch)
treeb79ab53a441a0e6da270a93574e18e0637e09b3b
parentcf124fb9614287e82d254dea67b778c46f831e76 (diff)
Enable clang-format for input code
Currently, there is no format enforcement for hid command. Add clang-format hook for all input-related code in frameworks/base. Bug: None Test: repo upload Change-Id: I08b8c6d1bae7d1954847c207ef8e6d80373b2d05
-rw-r--r--.clang-format13
-rw-r--r--PREUPLOAD.cfg10
2 files changed, 23 insertions, 0 deletions
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 000000000000..03af56d64062
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,13 @@
+BasedOnStyle: Google
+
+AccessModifierOffset: -4
+AlignOperands: false
+AllowShortFunctionsOnASingleLine: Inline
+AlwaysBreakBeforeMultilineStrings: false
+ColumnLimit: 100
+CommentPragmas: NOLINT:.*
+ConstructorInitializerIndentWidth: 6
+ContinuationIndentWidth: 8
+IndentWidth: 4
+PenaltyBreakBeforeFirstCallParameter: 100000
+SpacesBeforeTrailingComments: 1
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
index 68311176a783..78e72bf39586 100644
--- a/PREUPLOAD.cfg
+++ b/PREUPLOAD.cfg
@@ -1,3 +1,13 @@
+[Builtin Hooks]
+clang_format = true
+
+[Builtin Hooks Options]
+# Only turn on clang-format check for the following subfolders.
+clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp
+ cmds/hid/
+ cmds/input/
+ libs/input/
+
[Hook Scripts]
checkstyle_hook = ${REPO_ROOT}/prebuilts/checkstyle/checkstyle.py --sha ${PREUPLOAD_COMMIT}