skia2/.clang-format
Mike Klein 8f45138eef Revert "Update clang-format matching more of Chromium"
This reverts commit 4fa5824fa2.

Reason for revert:

This is an area of Chromium's style guide that is actively error-prone, and I don't want anyone writing Skia code to think it's desirable.  `goto fail`, etc.

If we cannot automatically add braces, it is less error prone to keep these short statements on the same line as the condition.

On the other hand, I believe clang-tidy can automate adding braces (readability-braces-around-statements).  If we get that working I don't think it matters where the blocks go.

Original change's description:
> Update clang-format matching more of Chromium
> 
> This CL does one thing: disallow short if/loop becoming a single
> line.
> 
> Skia style guide prefers to always have braces. Though always
> have braces isn't achievable by clang-format, always breaking into
> multiple lines can be set.
> 
> 
> 
> 
> Bug: skia:
> Change-Id: I70b504dea01b4c916901ea2247ac0e052d468051
> Reviewed-on: https://skia-review.googlesource.com/128688
> Commit-Queue: Weiliang Chen <weiliangc@chromium.org>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com,weiliangc@chromium.org

Change-Id: I264e0a38934aaf8059f503a64e204fd66da54769
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/129940
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2018-05-24 13:27:25 +00:00

105 lines
3.2 KiB
YAML

---
# Typical usage is to apply this to the lines you've modified in a local
# change. Stage your changes with "git add" and then run:
# $ git clang-format
# You can optionally use the "--" file filter to restrict formatting to certain
# files or directories. The tool will display the list of files that were
# modified. These have been modified without being staged. You can review the
# modifications using "git diff".
#
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 8
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: true
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: 'SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START'
MacroBlockEnd: 'SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END'
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 4
UseTab: Never
...