我的Java方法之一超过150行。重构这个方法将是一项艰巨的工作。 我知道默认方法长度设置为 150 行。
尝试将 checkStyle.xml 中的方法长度增加到 160
问题:
Method run length is 155 lines (max allowed is 150). [MethodLength]
仍然给出相同的错误。 错误:
Method run length is 155 lines (max allowed is 150). [MethodLength]
将此添加到我的 checkStyle.xml 中,但这不起作用。
<module name="MethodLength">
<property name="tokens" value="METHOD_DEF"/>
<property name="max" value="160"/>
</module>
在方法上添加了 @SuppressWarnings({"checkstyle:methodlength"}) 注释。 @SuppressWarnings 就像一个提醒,这个警告来自哪里。规则名称必须小写。