Skip to content

Instantly share code, notes, and snippets.

@StrangeRanger
Last active July 4, 2023 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save StrangeRanger/8f03b433f8ecf3ad425141a56f3f5dcc to your computer and use it in GitHub Desktop.
Save StrangeRanger/8f03b433f8ecf3ad425141a56f3f5dcc to your computer and use it in GitHub Desktop.
Java _clang-format configuration file (works for 'clang-format version 14.x.x')
---
Language: Java
# BasedOnStyle: Chromium
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignArrayOfStructures: Left # Maybe: Previously None
AlignConsecutiveAssignments: Consecutive
AlignConsecutiveBitFields: Consecutive
AlignConsecutiveDeclarations: Consecutive
AlignConsecutiveMacros: Consecutive
AlignEscapedNewlines: Left
AlignOperands: AlignAfterOperator
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: false # Unsure if this makes any difference
AllowAllParametersOfDeclarationOnNextLine: false # Unsure if this makes any difference
AllowShortEnumsOnASingleLine: true # Maybe
AllowShortBlocksOnASingleLine: Always # Maybe/OR Empty
AllowShortCaseLabelsOnASingleLine: true # Maybe
AllowShortFunctionsOnASingleLine: None
AllowShortLambdasOnASingleLine: Empty # Maybe/OR Always
AllowShortIfStatementsOnASingleLine: AllIfsAndElse # Maybe
AllowShortLoopsOnASingleLine: false
#AlwaysBreakAfterDefinitionReturnType: None # Deprecated
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine # Maybe
AttributeMacros:
- __capability
BinPackArguments: true # Maybe
BinPackParameters: true # Maybe
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: NonAssignment # OR None
BreakBeforeConceptDeclarations: Allowed
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon # OR AfterComma
BreakBeforeTernaryOperators: true # Maybe
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon # OR AfterColon
BreakAfterJavaFieldAnnotations: true
BreakStringLiterals: true
ColumnLimit: 94
CommentPragmas: '^ IWYU pragma:'
QualifierAlignment: Leave # Maybe (WARNING: Warning provided on website)
CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 8
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Leave
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
PackConstructorInitializers: BinPack # OR NextLine
#ConstructorInitializerAllOnOneLineOrOnePerLine: false # Deprecated
#AllowAllConstructorInitializersOnNextLine: true # Deprecated
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Merge
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^<.*\.h>'
Priority: 1
SortPriority: 0
CaseSensitive: false
- Regex: '^<.*'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 3
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '([-_](test|unittest))?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseLabels: true
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: AfterHash
IndentRequiresClause: false
IndentExternBlock: Indent
IndentWidth: 4
IndentWrappedFunctionNames: true
InsertBraces: true
InsertTrailingCommas: None
JavaImportGroups:
- android
- androidx
- com
- dalvik
- junit
- org
- com.google.android.apps.chrome
- org.chromium
- java
- javax
JavaScriptQuotes: Double
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
LambdaBodyIndentation: OuterScope
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: Inner # Maybe
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
ObjCBreakBeforeNestedBlockParam: true # TODO
ObjCSpaceAfterProperty: false # TODO
ObjCSpaceBeforeProtocolList: true # TODO
PenaltyBreakAssignment: 2 # TODO
PenaltyBreakBeforeFirstCallParameter: 1 # TODO
PenaltyBreakComment: 300 # TODO
PenaltyBreakFirstLessLess: 120 # TODO
PenaltyBreakOpenParenthesis: 120 # TODO
PenaltyBreakString: 1000 # TODO
PenaltyBreakTemplateDeclaration: 10 # TODO
PenaltyExcessCharacter: 1000000 # TODO
PenaltyReturnTypeOnItsOwnLine: 200 # TODO
PenaltyIndentedWhitespace: 0 # TODO
PointerAlignment: Right
PPIndentWidth: -1
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
- ParseTestProto
- ParsePartialTestProto
CanonicalDelimiter: pb
BasedOnStyle: google
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false # Maybe (WARNING: Warning provided on website)
RequiresClausePosition: OwnLine # Maybe (go back and possibly change)
SeparateDefinitionBlocks: Leave # Maybe
ShortNamespaceLines: 1
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: true
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: Custom
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterOverloadedOperator: false
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceAroundPointerQualifiers: Default
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
BitFieldColonSpacing: Both # Maybe
Standard: Auto
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 4
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
...
@StrangeRanger
Copy link
Author

Project Tracker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment