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

add code formatting target to makefile #2760

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions src/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
BasedOnStyle: LLVM
#AccessModifierOffset: -4
AlignAfterOpenBracket: BlockIndent
AlignArrayOfStructures: Left
#AlignConsecutiveAssignments: None
#AlignConsecutiveBitFields: AcrossComments
#AlignConsecutiveDeclarations: AcrossComments
#AlignConsecutiveMacros: AcrossComments
#AlignEscapedNewlines: Left
#AlignOperands: DontAlign
AlignTrailingComments: true
#AllowAllArgumentsOnNextLine: false
#AllowAllParametersOfDeclarationOnNextLine: false
#AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: true
#AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Inline
#AllowShortIfStatementsOnASingleLine: WithoutElse
#AllowShortLambdasOnASingleLine: Empty
#AllowShortLoopsOnASingleLine: false
#AlwaysBreakAfterReturnType: None
#AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
#BraceWrapping:
# AfterCaseLabel: false
# AfterClass: true
# AfterStruct: false
# AfterControlStatement: Never
# AfterEnum: true
# AfterFunction: true
# AfterNamespace: true
# AfterUnion: true
# BeforeCatch: true
# BeforeElse: false
# BeforeWhile: false
# IndentBraces: false
# SplitEmptyFunction: false
# SplitEmptyRecord: true
#BreakBeforeBraces: Custom
BreakBeforeBinaryOperators: None
#BreakBeforeTernaryOperators: true
#BreakConstructorInitializers: BeforeComma
#BreakInheritanceList: BeforeColon
ColumnLimit: 80
#CompactNamespaces: false
ContinuationIndentWidth: 4
#IncludeBlocks: Preserve
#IndentCaseLabels: false
#IndentPPDirectives: None
IndentWidth: 4
#InsertBraces: false
#KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 2
#NamespaceIndentation: None
#ObjCSpaceAfterProperty: false
#ObjCSpaceBeforeProtocolList: true
#PackConstructorInitializers: Never
#PointerAlignment: Left
ReflowComments: false
SortIncludes: Never
#SpaceAfterCStyleCast: false
#SpaceAfterLogicalNot: false
#SpaceAfterTemplateKeyword: false
#SpaceBeforeAssignmentOperators: true
#SpaceBeforeCpp11BracedList: true
#SpaceBeforeCtorInitializerColon: true
#SpaceBeforeInheritanceColon: false
#SpaceBeforeParens: ControlStatements
#SpaceBeforeRangeBasedForLoopColon: true
#SpaceInEmptyParentheses: false
#SpacesBeforeTrailingComments: 2
#SpacesInAngles: false
#SpacesInCStyleCastParentheses: false
#SpacesInContainerLiterals: false
#SpacesInParentheses: false
#SpacesInSquareBrackets: false
TabWidth: 4
UseTab: Never
12 changes: 12 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1421,4 +1421,16 @@ cscope:

cscopeclean:
bash -c 'for f in `find ./ -name "cscope.*out"`;do rm $$f;done'

.PHONY: format
format: format-cpp format-python

format-cpp:
$(ECHO) -n "formatting C/C++ files..."
@find -regex '.*\.\(cc\|cpp\|hpp\|cu\|c\|h\)' -exec clang-format -style=file -i "{}" \;
$(ECHO) "done"

format-python:
$(ECHO) "formatting python files..."
@black .
# vim:ts=8:sts=8:sw=8:noet:
Loading