checkstyle-can i change the`'('should be on the previous line?`rule of methodparampad?我可以更改“'”('应该在前一行吗?`rule of methodparampad?

1hdlvixo  于 2021-07-09  发布在  Java
关注(0)|答案(1)|浏览(245)

在格子风格中 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文件。
https://pastebin.com/2nxvzuja
如何使它执行第一个片段而不是第二个片段?

inb24sb2

inb24sb21#

我不认为你真的可以强制第二种风格,因为它会失败的调用 schema.getProperty .
不过,这一规定有其特殊性 allowLineBreaks 参数,您可以将其设置为true以使代码通过。看到了吗http://checkstyle.sourceforge.net/config_whitespace.html#methodparampad

<module name="MethodParamPad">
    <property name="allowLineBreaks" value="true" />
</module>

相关问题