Match .clang-format more closely to actual practice.

In order to attempt to get code like

    double VeryLongFunctionNames(double x1, double x2, double x3,
        double x4) {
      return 1.0;
    }

rather than

    double VeryLongFunctionNames(
        double x1, double x2, double x3, double x4) {
      return 1.0;
    }

I wrote a small set of programs to infer which .clang-format params
fit the current Impala codebase most closely; this patch is the
result.

This patch is the best the inferencer found (while maintaining certain
enforced parameters, like 90-character lines). It is about 10% closer
to Impala's current code base than the .clang-format that is checked
in at the moment, as measured by number of lines in the diff.

Change-Id: Iccaec6c1673c3e08d2c39200b0c84437af629aed
Reviewed-on: http://gerrit.cloudera.org:8080/4590
Reviewed-by: Jim Apple <jbap...@cloudera.com>
Tested-by: Jim Apple <jbap...@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/89b41c68
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/89b41c68
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/89b41c68

Branch: refs/heads/master
Commit: 89b41c68c180a96c4e34abfbe12f686d2461a7a3
Parents: 67a0451
Author: Jim Apple <jbap...@cloudera.com>
Authored: Sun Oct 2 06:06:03 2016 -0700
Committer: Jim Apple <jbap...@cloudera.com>
Committed: Fri Oct 14 00:08:17 2016 +0000

----------------------------------------------------------------------
 .clang-format | 49 +++++++++++++++++++++++++++++++++++--------------
 1 file changed, 35 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/89b41c68/.clang-format
----------------------------------------------------------------------
diff --git a/.clang-format b/.clang-format
index c0b9030..7c25a43 100644
--- a/.clang-format
+++ b/.clang-format
@@ -1,15 +1,36 @@
+---
+Language: Cpp
 BasedOnStyle: Google
-AlignAfterOpenBracket: 'false'
-AlignOperands: 'false'
-AllowShortCaseLabelsOnASingleLine: 'true'
-AllowShortFunctionsOnASingleLine: 'Inline'
-AllowShortIfStatementsOnASingleLine: 'true'
-BreakBeforeBinaryOperators: 'NonAssignment'
-BreakBeforeTernaryOperators: 'false'
-ColumnLimit: '90'
-ConstructorInitializerIndentWidth: '2'
-ContinuationIndentWidth: '4'
-DerivePointerAlignment: 'false'
-PenaltyBreakBeforeFirstCallParameter: '99999999'
-SpacesBeforeTrailingComments: '1'
-Standard: 'Cpp11'
+AlignAfterOpenBracket: DontAlign
+AlignOperands: false
+AlignTrailingComments: false
+AllowShortFunctionsOnASingleLine: Inline
+AlwaysBreakBeforeMultilineStrings: false
+BreakBeforeBinaryOperators: NonAssignment
+BreakBeforeTernaryOperators: false
+ColumnLimit: 90
+ConstructorInitializerIndentWidth: 2
+DerivePointerAlignment: false
+IncludeCategories:
+- Priority: 3
+  Regex: '^<.*/' # Like <boost/lexical_cast.hpp>
+- Priority: 1
+  Regex: '^<.*\.' # Like <fcntl.h>
+- Priority: 2
+  Regex: '^<' # Like <vector>
+- Priority: 4
+  Regex: '^"' # Like "util/auth-util.h"
+SpacesBeforeTrailingComments: 1
+Standard: Cpp11
+---
+Language: Java
+BasedOnStyle: Chromium
+AllowShortCaseLabelsOnASingleLine: true
+AllowShortFunctionsOnASingleLine: All
+AlwaysBreakBeforeMultilineStrings: true
+BreakBeforeTernaryOperators: false
+ColumnLimit: 90
+ContinuationIndentWidth: 4
+IndentWidth: 2
+IndentWrappedFunctionNames: true
+SortIncludes: true

Reply via email to