-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Add clang-format file #4238
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
base: main
Are you sure you want to change the base?
Add clang-format file #4238
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| --- | ||
| BasedOnStyle: Google | ||
| AlignAfterOpenBracket: DontAlign | ||
| AlignConsecutiveDeclarations: Consecutive | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This formats this: float fmod_t(float num, float denom) {
int tquot = num / denom;
float res = num - tquot * denom;
return res;
}to this: float fmod_t(float num, float denom) {
int tquot = num / denom;
float res = num - tquot * denom;
return res;
}I prefer the first version.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree - the extra spaces in |
||
| AlignEscapedNewlines: DontAlign | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this was set because of your tool. I see no reason why we should set this to |
||
| AlignOperands: DontAlign | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the rare case that this happens, I think aligning would improve readability here. |
||
| AlignTrailingComments: false | ||
| AllowAllArgumentsOnNextLine: false | ||
| AllowShortCaseLabelsOnASingleLine: true | ||
| AllowShortFunctionsOnASingleLine: None | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you want to set this to Now this formats this: int add(int a, int b) { return a + b; }to this: int add(int a, int b) {
return a + b;
} |
||
| AllowShortIfStatementsOnASingleLine: Always | ||
| AlwaysBreakBeforeMultilineStrings: false | ||
| BreakBeforeTernaryOperators: false | ||
| BreakConstructorInitializersBeforeComma: true | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| BreakStringLiterals: false | ||
| ColumnLimit: 240 | ||
| ContinuationIndentWidth: 2 | ||
| IndentPPDirectives: BeforeHash | ||
| KeepEmptyLinesAtTheStartOfBlocks: true | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This option is deprecated. See: https://clang.llvm.org/docs/ClangFormatStyleOptions.html#keepemptylinesatthestartofblocks
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Deprecated empty-lines option 🤖 Prompt for AI Agents |
||
| MaxEmptyLinesToKeep: 2 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we should change this so that the code doesn't take up so many lines? |
||
| ReflowComments: false | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we should at least set this to |
||
| SortIncludes: Never | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not? |
||
| SpacesBeforeTrailingComments: 1 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,4 @@ | ||
| .cache | ||
| .clang-format | ||
| .direnv | ||
| .DS_Store | ||
| .idea | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in the rare case where we exceed the
ColumnLimit, aligning would improve readability.