suppression - How can I suppress specific checkstyle rules in eclipse? -
i'm trying use suppression filter unexpected error occurs.
following error message.
"cannot initialize module suppressionfilter - cannot set property 'file' in module suppressionfilter 'checkstyle-suppressions.xml': unable find checkstyle-suppressions.xml - document root element "suppressions", must match doctype root "module"."
could let me know how can resolve error?
followings configuration file , suppression file contents used. configured suppression filter through eclipse menu(windows > preferences > checkstyle > configure > known modules filter > suppression filter > add)
======================================
configuration file is
<?xml version="1.0" encoding="utf-8"?> <!doctype module public "-//puppy crawl//dtd check configuration 1.3//en" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> <module name="checker"> <property name="severity" value="warning"/> <module name="treewalker"> <module name="magicnumber"> <property name="ignorenumbers" value="-1, 0, 1"/> </module> </module> </module>
===================================
suppression filter file ...
<?xml version="1.0" encoding="utf-8"?> <!doctype module public "-//puppy crawl//dtd check configuration 1.3//en" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> <suppressions> <suppress checks="magicnumbercheck" files="home.java" lines="350-370"/> </suppressions>
your suppression filter file uses 1.1 syntax, claims using newer 1.3 syntax. exchange header so:
<!doctype suppressions public "-//puppy crawl//dtd suppressions 1.1//en" "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
also, configuration file must reference suppression filter. add module definition (add before last closing </module>
tag, not under treewalker
):
<module name="suppressionfilter"> <property name="file" value="${workspace_loc}/myproject/suppressions.xml"/> </module>
using ${workspace_loc}
variable makes sure works when copy or rename workspace.
Comments
Post a Comment