Last active
April 7, 2025 21:13
-
-
Save kdkasad/4ec1905d4a55773328b6924f095f5f3d to your computer and use it in GitHub Desktop.
Clang-Format style definition for CS 240
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# Written by Kian Kasad <[email protected]>. | |
# See https://clang.llvm.org/docs/ClangFormatStyleOptions.html. | |
# Requires clang-format >=20.x.x. | |
Language: C | |
AlignAfterOpenBracket: Align | |
AlignArrayOfStructures: None | |
AlignConsecutiveAssignments: None | |
AlignConsecutiveBitFields: Consecutive | |
AlignConsecutiveDeclarations: None | |
AlignConsecutiveMacros: None | |
AlignEscapedNewlines: LeftWithLastLine | |
AlignOperands: Align | |
AlignTrailingComments: Never | |
AllowAllArgumentsOnNextLine: true | |
AllowAllParametersOfDeclarationOnNextLine: true | |
AllowShortBlocksOnASingleLine: Never | |
AllowShortCaseLabelsOnASingleLine: false | |
AllowShortEnumsOnASingleLine: false | |
AllowShortFunctionsOnASingleLine: None | |
AllowShortIfStatementsOnASingleLine: Never | |
AllowShortLoopsOnASingleLine: false | |
AllowShortNamespacesOnASingleLine: false | |
AlwaysBreakBeforeMultilineStrings: false | |
BinPackArguments: true | |
BinPackParameters: BinPack | |
BitFieldColonSpacing: After | |
BraceWrapping: | |
AfterCaseLabel: false | |
AfterClass: false | |
AfterControlStatement: Never | |
AfterEnum: false | |
AfterFunction: false | |
AfterStruct: false | |
AfterUnion: false | |
BeforeElse: true | |
BeforeWhile: false | |
BreakAdjacentStringLiterals: true | |
BreakAfterAttributes: Always | |
BreakAfterReturnType: Automatic | |
BreakBeforeBinaryOperators: false | |
BreakBeforeBraces: Custom | |
BreakBeforeInlineASMColon: Always | |
BreakBeforeTernaryOperators: true | |
BreakBinaryOperations: Never | |
BreakFunctionDefinitionParameters: false | |
BreakStringLiterals: false | |
ColumnLimit: 80 | |
ContinuationIndentWidth: 2 | |
DerivePointerAlignment: false | |
DisableFormat: false | |
EmptyLineAfterAccessModifier: Leave | |
EmptyLineBeforeAccessModifier: Leave | |
IncludeBlocks: Regroup | |
IncludeCategories: | |
# Header corresponding to source file automatically gets priority 0 | |
- Regex: '^<[^/]+>$' | |
Priority: 1 | |
- Regex: '^<.+/.+>$' | |
Priority: 2 | |
- Regex: '^".+"$' | |
Priority: 3 | |
IndentCaseBlocks: false | |
IndentCaseLabels: true | |
IndentGotoLabels: false | |
IndentPPDirectives: None | |
IndentWidth: 2 | |
IndentWrappedFunctionNames: false | |
InsertBraces: true | |
InsertNewlineAtEOF: true | |
KeepEmptyLines: | |
AtEndOfFile: false | |
AtStartOfBlock: true | |
AtStartOfFile: false | |
KeepFormFeed: false | |
LineEnding: LF | |
MainIncludeChar: Quote | |
MaxEmptyLinesToKeep: 1 | |
PPIndentWidth: -1 | |
PointerAlignment: Right | |
QualifierAlignment: Left | |
ReflowComments: Always | |
RemoveEmptyLinesInUnwrappedLines: true | |
RemoveParentheses: ReturnStatement | |
RemoveSemicolon: true | |
SortIncludes: CaseSensitive | |
SpaceAfterCStyleCast: true | |
SpaceAfterLogicalNot: false | |
SpaceAroundPointerQualifiers: After | |
SpaceBeforeAssignmentOperators: true | |
SpaceBeforeCaseColon: false | |
SpaceBeforeParens: ControlStatementsExceptControlMacros | |
SpaceBeforeSquareBrackets: false | |
SpaceInEmptyBlock: false | |
SpacesBeforeTrailingComments: 2 | |
SpacesInLineCommentPrefix: | |
Minimum: 1 | |
Maximum: 2 | |
SpacesInParens: Never | |
SpacesInSquareBrackets: false | |
TabWidth: 8 | |
UseTab: Never | |
PenaltyBreakBeforeFirstCallParameter: 100 | |
PenaltyReturnTypeOnItsOwnLine: 100 | |
PenaltyBreakBeforeMemberAccess: 100 | |
PenaltyBreakString: 5 | |
PenaltyExcessCharacter: 1000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently doesn't wrap string literals which are too long, because when I tried to make it do that, I got some weird behavior that might be a clang-format bug.
Flip
BreakAdjacentStringLiterals
andBreakStringLiterals
from their current values to try it out.