Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

format with clang-format #278

Merged
merged 5 commits into from
Jan 17, 2025
Merged

Conversation

michaelolbrich
Copy link
Member

No description provided.

@Harvie
Copy link
Contributor

Harvie commented Jan 10, 2025

Some things you might not like about your format:

You said it's a mess when comments are not aligned (clang format can align them):

image

This is complete mess (but i am not sure how to fix that in clang-format):

image

BTW i usualy use something like this, but i don't consider it perfect in any way. But it seem to align some stuff better.

#BasedOnStyle: Google
BreakBeforeBraces: Linux
SortIncludes: false
IncludeBlocks: Preserve
ColumnLimit: 130
UseTab: Always
IndentWidth: 8
ContinuationIndentWidth: 8

ReflowComments: false
#SpacesBeforeTrailingComments: 8
#AccessModifierOffset: 0
BreakStringLiterals: false

AlignTrailingComments: true
AlignConsecutiveMacros: true
AlignConsecutiveDeclarations: true
AlignConsecutiveAssignments: true
AlignEscapedNewlines: true
AlignOperands: true
AlignAfterOpenBracket: false

AllowShortBlocksOnASingleLine: true
AllowShortFunctionsOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: true
AllowShortLambdasOnASingleLine: true
AllowShortLoopsOnASingleLine: true

@Harvie
Copy link
Contributor

Harvie commented Jan 10, 2025

cfg_opts_t problem seems to be fixed by adding this:

PackConstructorInitializers: CurrentLine

Overall code seems to be more readable with those:

PackConstructorInitializers: CurrentLine
AlignTrailingComments: true
AlignConsecutiveMacros: true
AlignConsecutiveDeclarations: true
AlignConsecutiveAssignments: true
AlignEscapedNewlines: true
AlignOperands: true
AlignAfterOpenBracket: false

@michaelolbrich michaelolbrich merged commit 8431450 into pengutronix:master Jan 17, 2025
5 checks passed
@michaelolbrich michaelolbrich deleted the format branch January 17, 2025 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants