简体   繁体   English

如何在checkstyle的“excludedClasses”中设置默认+自己的类

[英]How to set default + own classes in "excludedClasses" in checkstyle

I am using checkstyle with the following configuration in checkstyle.xml我在 checkstyle.xml 中使用具有以下配置的checkstyle.xml

<module name="ClassFanOutComplexity">
    <property name="max" value="20"/>
    <property name="excludedClasses" value="MyLogger"/>
</module>

I want to exclude MyLogger class but with default classes also excluded without writing them to "excludedClasses" property我想排除MyLogger类,但也排除了默认类,而不将它们写入“excludedClasses”属性

Unfortunately, it is not possible to extend default list, one can only override it.不幸的是,无法扩展默认列表,只能覆盖它。

There is a workaround - you can use excludeClassesRegexps property and specify your class name there, eg有一个解决方法 - 您可以使用excludeClassesRegexps属性并在那里指定您的类名,例如

<module name="ClassFanOutComplexity">
    <property name="max" value="20"/>
    <property name="excludeClassesRegexps" value="MyLogger"/>
</module>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM