Java Clang格式是否可以在多行上拆分同一类型的多个变量声明?
我正在使用clang格式在Google formatter上美化我的Java代码 基本上可以,但它不允许在多行上进行多个声明 它打包了变量声明Java Clang格式是否可以在多行上拆分同一类型的多个变量声明?,java,formatting,checkstyle,pmd,clang-format,Java,Formatting,Checkstyle,Pmd,Clang Format,我正在使用clang格式在Google formatter上美化我的Java代码 基本上可以,但它不允许在多行上进行多个声明 它打包了变量声明 字符串一、二、三 变成一条直线,而我希望它们在三条直线上垂直对齐 像这样: String one, two, three; (我无法正确对齐,因此) 我的叮当格式配置文件如下: Language: Java # BasedOnStyle: Google AccessModifierOffset: -1 Al
字符串一、二、三代码>
变成一条直线,而我希望它们在三条直线上垂直对齐
像这样:
String one,
two,
three;
(我无法正确对齐,因此)
我的叮当格式配置文件如下:
Language: Java
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
#AllowShortLambdasOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: true
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
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
CanonicalDelimiter: ''
BasedOnStyle: google
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 2
UseTab: Never
...
语言:Java
#BasedOnStyle:谷歌
AccessModifierRoffset:-1
AlignAfterOpen支架:对齐
对齐连续指定:false
对齐连续偏差:false
对齐转义换行符:左
对齐操作数:true
AlignTrailingComments:正确
AllowWallParametersOfDeclarationOnNextline:false
AllowShortBlocksOnASingleLine:false
AllowShortCaselLabelSonaSingleLine:false
AllowShortFunction单线:无
AllowShortIfStatementsOnASingleLine:false
#AllowShortlambdasonSingleline:false
AllowShortLoopsOnASingleLine:false
AlwaysBreakAfterDefinition返回类型:无
AlwaysBreakAfterReturnType:无
总是在多重限制之前突破:正确
AlwaysBreakTemplate声明:是
BinPackArguments:false
BinPackParameters:false
大括号包装:
课后:假
AfterControlStatement:错误
AfterEnum:false
后功能:false
AfterNamespace:false
声明:false
战后:假
联合后:假
AfterExternBlock:错误
捕获前:错误
在其他之前:错误
大括号缩进:false
SplitEmptyFunction:true
SplitEmptyRecord:正确
SplitEmptyNamespace:true
BreakBeforeBaryOperators:不指定
断开前支撑:连接
BreakBeforeInheritance逗号:false
BreakInheritanceList:BeforeColon
BreakBeforeTernaly运算符:true
BreakConstructorInitializersBeforeComa:false
BreakConstructorInitializers:BeforeConon
BreakAfterJavaFieldAnnotations:true
BreakStringLiterals:true
限额:80
注释pragma:“^IWYU pragma:”
CompactNamespaces:false
构造函数初始化LonOneLine或NeperLine:true
构造函数InitializerInDentWidth:4
连续缩进宽度:4
Cpp11BracedListStyle:true
DerivePointerAlignment:真
禁用格式:false
实验自动检测打包:错误
FixNamespaceComments:true
ForEachMacros:
-弗雷奇
-Q_FOREACH
-增压器
包含块:保存
IncludeCategories:
-正则表达式:“^”
优先事项:2
-正则表达式:“^”
优先事项:1
-正则表达式:“^如果您希望在三行上声明,为什么不使用三个单独的声明呢?我更感兴趣的是clang格式是否可以解决这个问题。如果需要,我可以禁用PMD和Checkstyle规则。那也会让那个狗熊离开的。我想知道clang格式是否能像GoogleJava格式那样,我确实希望它超过三行,但不能声明三行。这是一个问题,在处理其他语言时,这是一个问题,即C、C++,指针和地址变量。如果你想在三行上声明,为什么不使用三个单独的声明?我更感兴趣的是CLAN格式是否能修复这个问题。如果需要,我可以禁用PMD和Checkstyle规则。那也会让那个狗熊离开的。我想知道clang格式是否能像GoogleJava格式那样,我确实希望它超过三行,但不能声明三行。这是一个问题,在处理其他语言,例如C,C++时,会遇到指针和地址变量吗?