-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Description
We recently trying to upgrade LLVM version including clang-format from from 19.1.7 to 20.1.7
There are no changes to the configuration, yet we have a lot of changes in the code due to line breaking.
An example would be from:
setSomeDummyParam(DummyParametersss{
.paramAaaa = true, .paramBbbbbbbbbbb = paramBbbbbbbbbbb, .paramCccccccccc = paramCccccccccc});
to:
setSomeDummyParam(
DummyParametersss{
.paramAaaa = true, .paramBbbbbbbbbbb = paramBbbbbbbbbbb, .paramCccccccccc = paramCccccccccc});
Names are anonymized to reflect their lengths.
In a big project such our, it creates a problem as we then end up with a change that modifies over 1600 files and creates almost 20k lines modified.
I tried to work with new parameters that were added/changed between releases, but none provided help to reduce the number of modified lines.
This is not the first time it happened to us. My expectation would be that until configuration is changes, no impact to the existing format should be done between releases, or at least we should have option to work with configuration to mitigate the impact.
Did I miss something that caused such behavior and it can be mitigated by configuration?
Maybe it would be good to consider such scenarios in the future to avoid such impacts even if major change is updated?
Here is my current configuration (from the top to bottom in the tree structure):
top level:
---
BreakBeforeBraces: Allman
ColumnLimit: 120
IndentWidth: 4
TabWidth: 4
UseTab: Never
---
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignOperands: false
AlignTrailingComments: false
AlignEscapedNewlinesLeft: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
BreakStringLiterals: true
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DisableFormat: false
FixNamespaceComments: true
IncludeCategories:
- Regex: '^<sys/'
Priority: 1
- Regex: '^<'
Priority: 2
- Regex: '^"'
Priority: 3
IndentCaseLabels: true
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
BraceWrapping:
AfterNamespace: false
AfterUnion: true
NamespaceIndentation: None
PenaltyReturnTypeOnItsOwnLine: 5000
PointerAlignment: Left
SortIncludes: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
Standard: Cpp11
---
Language: Proto
AlwaysBreakAfterReturnType: All
AllowShortFunctionsOnASingleLine: false
inner directory:
---
BasedOnStyle: InheritParentConfig
---
Language: Cpp
InsertBraces: true
InsertNewlineAtEOF: true
KeepEmptyLines:
AtEndOfFile: false
AtStartOfBlock: false
AtStartOfFile: false
LineEnding: LF
SpaceAfterLogicalNot: true
SpacesInParens: Never