eclipse checkstyle 错误无法初始化模块 TreeWalker - TreeWalker 不允许作为 FileLength 的父级
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17343018/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
eclipse checkstyle error cannot initialize module TreeWalker - TreeWalker is not allowed as a parent of FileLength
提问by Anand B
I get the following error when I try to load a user defined check style template.
当我尝试加载用户定义的检查样式模板时出现以下错误。
cannot initialize module TreeWalker - TreeWalker is not allowed as a parent of FileLength
I think it might be due to the incompatibilty with checkstyle version in my eclipse. How will I be able to find the appropriate checkstyle version with checkstyle xml file
我认为这可能是由于我的 eclipse 中的 checkstyle 版本不兼容。我将如何使用 checkstyle xml 文件找到合适的 checkstyle 版本
回答by barfuin
This is an error in the template, independent of the Checkstyle version. FileLength
goes directly under Checker
, not under TreeWalker
.
这是模板中的错误,与 Checkstyle 版本无关。FileLength
直接下Checker
,不下TreeWalker
。
Example:
例子:
<module name="Checker">
<property name="severity" value="warning"/>
<module name="TreeWalker">
<property name="tabWidth" value="4"/>
<module name="JavadocType"/>
<!-- many others -->
</module>
<module name="NewlineAtEndOfFile"/>
<module name="FileLength"/>
<module name="JavadocPackage"/>
<!-- others -->
</module>