Nick Williams created MCHECKSTYLE-442: -----------------------------------------
Summary: Not possible to specify ignoreStringsRegexp property for module name MultipleStringLiterals Key: MCHECKSTYLE-442 URL: https://issues.apache.org/jira/browse/MCHECKSTYLE-442 Project: Maven Checkstyle Plugin Issue Type: Bug Components: checkstyle:check Reporter: Nick Williams The [checkstyle documentation|https://checkstyle.sourceforge.io/checks/coding/multiplestringliterals.html] specifies this example for ignoring certain strings by regex in module {{MultipleStringLiterals}}. {code:xml} <module name="MultipleStringLiterals"> <property name="ignoreStringsRegexp" value='^(("")|(", "))$'/> </module> {code} 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: {noformat} [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] {noformat} 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. {code:xml} <property name="ignoreStringsRegexp" value='^""$' /> <property name="ignoreStringsRegexp" value="^""$" /> <property name="ignoreStringsRegexp" value='^(("")|(", "))$' /> <property name="ignoreStringsRegexp" value='^("")|(", ")$' /> {code} 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: {code:xml} <property name="ignoreStringsRegexp" value='^$' /> <property name="ignoreStringsRegexp" value='^()$' /> {code} So it would seem that it's not possible to use legal XML techniques to insert double quotes into property values. -- This message was sent by Atlassian Jira (v8.20.10#820010)