简体   繁体   中英

How to set default + own classes in "excludedClasses" in checkstyle

I am using checkstyle with the following configuration in 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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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