无法解决我应该如何为 maven 插件配置 checkstyle 文件。我有这样的片段:
@NamedQueries({
@NamedQuery(name = Session.GET_ENTRIES_BY_STATUS, query = "some SQL query"),
@NamedQuery(name = Session.CHECK_SESSION, query = "some SQL query"),
@NamedQuery(name = Session.DELETE_ENTRIES_BY_LASTDATE, query = "some SQL query")
})
或另一个注释初始化:
@JsonPropertyOrder({
"username",
"icon_emoji",
"channel",
"attachments"
})
result.xml 中的输出总是将其显示为违规:
<error line="30" severity="warning" message="'}' have incorrect indentation level 0, expected level should be 8." source="com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck"/>
我的缩进块是:
<module name="Indentation">
<property name="basicOffset" value="4"/>
<property name="braceAdjustment" value="0"/>
<property name="caseIndent" value="4"/>
<property name="throwsIndent" value="8"/>
<property name="lineWrappingIndentation" value="8"/>
<property name="arrayInitIndent" value="4"/>
</module>
右卷曲块是:
<module name="RightCurly">
<property name="id" value="RightCurlySame"/>
<property name="tokens" value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_DO"/>
</module>
<module name="RightCurly">
<property name="id" value="RightCurlyAlone"/>
<property name="option" value="alone"/>
<property name="tokens" value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT, INSTANCE_INIT"/>
</module>
如果这样的列表似乎是正确的代码样式,我该如何摆脱这种违规行为?