Checkstyle - 我可以更改 MethodParamPad 的 `'(' 应该在前一行吗?` 规则?
Checkstyle - can i change the `'(' should be on the previous line?` rule of MethodParamPad?
在 checkstyle 中,MethodParamPad
生成消息 -
'(' should be on the previous line
在我的代码中,例如它不喜欢
schema.withProperty(propertyName, createStringType(propertyAnnotation, annotations.getAnnotationByClass
(StringSchema.class)));
想要:
schema.withProperty(propertyName, createStringType(propertyAnnotation, annotations.getAnnotationByClass(
StringSchema.class)));
这是我目前的 checkstyle.xml 文件。
我怎样才能让它强制执行第一个片段,而不是第二个片段?
我不认为你可以从字面上强制执行第二种样式,因为它会在调用 schema.getProperty
.
时失败
但是,该规则有一个 allowLineBreaks
参数,您可以将其设置为 true 以使您的代码通过。
参见 http://checkstyle.sourceforge.net/config_whitespace.html#MethodParamPad
<module name="MethodParamPad">
<property name="allowLineBreaks" value="true" />
</module>
在 checkstyle 中,MethodParamPad
生成消息 -
'(' should be on the previous line
在我的代码中,例如它不喜欢
schema.withProperty(propertyName, createStringType(propertyAnnotation, annotations.getAnnotationByClass
(StringSchema.class)));
想要:
schema.withProperty(propertyName, createStringType(propertyAnnotation, annotations.getAnnotationByClass(
StringSchema.class)));
这是我目前的 checkstyle.xml 文件。
我怎样才能让它强制执行第一个片段,而不是第二个片段?
我不认为你可以从字面上强制执行第二种样式,因为它会在调用 schema.getProperty
.
但是,该规则有一个 allowLineBreaks
参数,您可以将其设置为 true 以使您的代码通过。
参见 http://checkstyle.sourceforge.net/config_whitespace.html#MethodParamPad
<module name="MethodParamPad">
<property name="allowLineBreaks" value="true" />
</module>