summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Bray <ncbray@google.com>2018-08-06 13:49:10 -0700
committerNick Bray <ncbray@google.com>2018-08-06 13:49:10 -0700
commit069264362a71e9bc926dad61b9b70e70b60bbb0e (patch)
treefc4c0be8d1d254d9230db9291aa00ab83ecb5040
parent67fc62390fa2d9bd6605afc0fb64035e59894519 (diff)
downloadimx7d-069264362a71e9bc926dad61b9b70e70b60bbb0e.tar.gz
Enable pre-upload clang formatting.
Bug: 110489128 Change-Id: I710998559f64c85d6de6208ec2b66a4a871fd1d8
-rw-r--r--.clang-format24
-rw-r--r--PREUPLOAD.cfg7
2 files changed, 31 insertions, 0 deletions
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..97e6791
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,24 @@
+# Trusty Style
+# This is a Google-derived style with 4-space indent and a few quirks for
+# systems code.
+BasedOnStyle: Chromium
+
+# 4-space indent, no tabs.
+IndentWidth: 4
+UseTab: Never
+TabWidth: 4
+
+# Double indent arguments when none of them are on the first line.
+ContinuationIndentWidth: 8
+ConstructorInitializerIndentWidth: 8
+
+# Don't indent public/private/protected.
+# It's a little more common to do a half indent, but folks didn't like that.
+AccessModifierOffset: -4
+
+# Don't indent case labels.
+IndentCaseLabels: false
+
+# Don't break strings to make it easier to grep for error messages.
+# Note: this can result in lines that exceed the column limit.
+BreakStringLiterals: false
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
new file mode 100644
index 0000000..587b0de
--- /dev/null
+++ b/PREUPLOAD.cfg
@@ -0,0 +1,7 @@
+[Builtin Hooks]
+clang_format = true
+commit_msg_bug_field = true
+commit_msg_changeid_field = true
+
+[Builtin Hooks Options]
+clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp