Skip to content

Commit 69c4c65

Browse files
Harsh-Agrawal96romani
authored andcommitted
Issue #13345: enabling tests for RegexpCheckExampleTest
1 parent 05b2a32 commit 69c4c65

File tree

28 files changed

+468
-691
lines changed

28 files changed

+468
-691
lines changed

config/checkstyle-checks.xml

+5-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@
6161
<property name="lineRange" value="1"/>
6262
<property name="idPattern" value="lineLengthXml"/>
6363
</module>
64-
64+
<module name="SuppressWithNearbyTextFilter">
65+
<property name="nearbyTextPattern" value="violation above 'Trailing whitespace'"/>
66+
<property name="lineRange" value="-1"/>
67+
<property name="checkPattern" value="RegexpSingleline"/>
68+
</module>
6569
<!-- Headers -->
6670
<module name="Header">
6771
<property name="headerFile" value="${checkstyle.header.file}"/>

config/checkstyle-examples-checks.xml

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
<module name="SuppressionFilter">
1313
<property name="file" value="${checkstyle.examples-suppressions.file}"/>
1414
</module>
15-
15+
<module name="SuppressWithNearbyTextFilter">
16+
<property name="nearbyTextPattern" value="violation above 'Trailing whitespace'"/>
17+
<property name="lineRange" value="-1"/>
18+
<property name="checkPattern" value="RegexpSingleline"/>
19+
</module>
1620
<!-- Regexp -->
1721
<module name="RegexpOnFilename">
1822
<property name="id" value="exampleFileName"/>

config/checkstyle-examples-suppressions.xml

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
<suppressions>
88

9+
<!-- private class used to show violation on it -->
10+
<suppress id="exampleClassName"
11+
files="regexp[\\/]Example4.java"/>
12+
913
<!-- The files have no exampleClassName by design. -->
1014
<suppress id="exampleClassName"
1115
files="outertypefilename[\\/]Example3.java"/>

config/jsoref-spellchecker/whitelist.words

-4
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,6 @@ NODESET
917917
noembed
918918
noenumtrailingcomma
919919
nofinalizer
920-
NOI
921920
noinspection
922921
noinspectionreason
923922
nojavadoc
@@ -1048,7 +1047,6 @@ Perror
10481047
pgjdbc
10491048
Pgpg
10501049
Pgpgv
1051-
pguyot
10521050
php
10531051
picocli
10541052
pid
@@ -1147,7 +1145,6 @@ returnsreceiver
11471145
reviewdog
11481146
revwalk
11491147
rfc
1150-
rfe
11511148
Rgb
11521149
rgba
11531150
rhs
@@ -1199,7 +1196,6 @@ SEO
11991196
separatorwrap
12001197
SERIALVERSIONUID
12011198
servlet
1202-
SETPOINT
12031199
severitymatchfilter
12041200
sevntu
12051201
shanegenschaw

src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpCheck.java

+13
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,19 @@
9090
* if you want to match a &lt; symbol you need to enter &amp;lt;.
9191
* The regular expression should be entered on one line.
9292
* </p>
93+
*
94+
* <p>
95+
* <b>Note:</b> To search for parentheses () in a regular expression
96+
* you must escape them like \(\). This is required by the regexp engine,
97+
* otherwise it will think they are special instruction characters.
98+
* </p>
99+
*
100+
* <p>
101+
* <b>Note:</b> To search for things that mean something in XML, like
102+
* &lt; you need to escape them like &amp;lt;. This is required so the
103+
* XML parser does not act on them, but instead passes the correct
104+
* character to the regexp engine.
105+
* </p>
93106
* <ul>
94107
* <li>
95108
* Property {@code duplicateLimit} - Control whether to check for duplicates

src/main/resources/com/puppycrawl/tools/checkstyle/meta/checks/regexp/RegexpCheck.xml

+13
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,19 @@
6262
the XML config file you must also take into account the XML rules. e.g.
6363
if you want to match a &amp;lt; symbol you need to enter &amp;amp;lt;.
6464
The regular expression should be entered on one line.
65+
&lt;/p&gt;
66+
67+
&lt;p&gt;
68+
&lt;b&gt;Note:&lt;/b&gt; To search for parentheses () in a regular expression
69+
you must escape them like \(\). This is required by the regexp engine,
70+
otherwise it will think they are special instruction characters.
71+
&lt;/p&gt;
72+
73+
&lt;p&gt;
74+
&lt;b&gt;Note:&lt;/b&gt; To search for things that mean something in XML, like
75+
&amp;lt; you need to escape them like &amp;amp;lt;. This is required so the
76+
XML parser does not act on them, but instead passes the correct
77+
character to the regexp engine.
6578
&lt;/p&gt;</description>
6679
<properties>
6780
<property default-value="0" name="duplicateLimit" type="int">

0 commit comments

Comments
 (0)