Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Incomplete
-
None
-
None
-
None
Description
The checkstyle documentation specifies this example for ignoring certain strings by regex in module MultipleStringLiterals.
<module name="MultipleStringLiterals"> <property name="ignoreStringsRegexp" value='^(("")|(", "))$'/> </module>
Not only does this example not work, but no useful value for this property works. Any regex that contains a double quote ("), which is required for this property to work, results in an error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.3.0:check (checkstyle-verify-style) on project oss-parent: Failed during checkstyle execution: Failed during checkstyle configuration: unable to parse configuration stream - Element type "property" must be followed by either attribute specifications, ">" or "/>".:94:85 -> [Help 1]
In addition to trying their example verbatim, I have tried all of the following, all of which result in the same error. I cannot find a workaround, so I am unable to use this property.
<property name="ignoreStringsRegexp" value='^""$' /> <property name="ignoreStringsRegexp" value="^""$" /> <property name="ignoreStringsRegexp" value='^""$' /> <property name="ignoreStringsRegexp" value="^(("")|(", "))$" /> <property name="ignoreStringsRegexp" value='^(("")|(", "))$' /> <property name="ignoreStringsRegexp" value="^("")|(", ")$" /> <property name="ignoreStringsRegexp" value='^("")|(", ")$' />
The parentheses and other symbols do not appear to be a problem, because the following do not result in any errors, they're just also not useful because checkstyle won't match on them:
<property name="ignoreStringsRegexp" value='^$' /> <property name="ignoreStringsRegexp" value='^()$' />
So it would seem that it's not possible to use legal XML techniques to insert double quotes into property values.