Checkstyle of varying severity for the same property-based module

Is it possible to have different levels of severity for the same module, but with different properties?

This is what I look at:

<module name="IllegalThrows"> <property name="illegalClassNames" value="NullPointerException,java.lang.RuntimeException,Exception"/> </module> <module name="IllegalThrows"> <property name="illegalClassNames" value="Exception"/> <property name="severity" value="warning"/> </module> 
+5
source share
1 answer

Yes, that's great! There are some minor glitches in your sample code; here is a slightly modified version:

 <module name="IllegalThrows"> <property name="severity" value="warning"/> <property name="illegalClassNames" value="java.lang.NullPointerException,java.lang.RuntimeException"/> </module> <module name="IllegalThrows"> <property name="severity" value="error"/> <property name="illegalClassNames" value="java.lang.Exception"/> </module> 

I set a severity for both modules. You can leave it if it matches the default severity (usually warning ). In addition, I removed the redundancy when an Exception was declared in both modules. This will cause you to get two problems for the same line of code. It is enough to specify only full class names.

+4
source

Source: https://habr.com/ru/post/1232435/


All Articles