Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ignore checkstyle on methods according to a specific pattern

Is there a way for the checkstyle rule MethodLength to set a pattern for methods to be ignored? I want to suppress the checkstyle rule for all methods named getMetaInformation().

Other checkstyle rules like LineLength have the property

<property name="ignorePattern" value=""/>

but this seems not to be available for the MethodLengthrule (see http://checkstyle.sourceforge.net/apidocs/com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheck.html).

like image 518
Xsasan Avatar asked Jul 25 '16 07:07

Xsasan


People also ask

How do you ignore checkstyle?

Then to disable Checkstyle, you use //CHECKSTYLE:OFF and //CHECKSTYLE:ON (default values) in your code.

How to Suppress checkstyle with annotations?

It is possible to suppress all the checkstyle warnings with the argument "all" . You can also use a checkstyle: prefix to prevent compiler from processing these annotations. You can also define aliases for check names that need to be suppressed.


1 Answers

Currently, there is no way to do this by Check config http://checkstyle.sourceforge.net/config_sizes.html#MethodLength , you need to use suppressions/filters to do this.

like image 66
Roman Ivanov Avatar answered Oct 04 '22 17:10

Roman Ivanov