diff --git a/config/checkstyle_checks.xml b/config/checkstyle_checks.xml index 8120e9c85..ea52c96c6 100644 --- a/config/checkstyle_checks.xml +++ b/config/checkstyle_checks.xml @@ -52,9 +52,10 @@ + + diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/DetectorOptions.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/DetectorOptions.java index 30e5571c2..b42119b95 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/DetectorOptions.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/DetectorOptions.java @@ -35,8 +35,11 @@ class DetectorOptions { private final int compileFlags; /** Used for reporting violations. */ private final AbstractViolationReporter reporter; - /** Format of the regular expression to check for. */ - private String format; + /** + * Format of the regular expression to check for. Default value is pattern that never matches + * any string. + */ + private String format = "$."; /** The message to report on detection. If blank, then use the format. */ private String message = ""; /** Minimum number of times regular expression should occur in a file. */ diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpMultilineCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpMultilineCheckTest.java index fb7f08b24..73858a399 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpMultilineCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpMultilineCheckTest.java @@ -112,4 +112,11 @@ public class RegexpMultilineCheckTest extends BaseFileSetCheckTestSupport { verify(checkConfig, file.getPath(), expected); } + @Test + public void testDefaultConfiguration() throws Exception { + final DefaultConfiguration checkConfig = createCheckConfig(RegexpMultilineCheck.class); + final String[] expected = { + }; + verify(checkConfig, getPath("InputSemantic.java"), expected); + } }