Skip to content

Commit

Permalink
Issue checkstyle#15605: update TodoComment to show how to use ignore …
Browse files Browse the repository at this point in the history
…case in format property
  • Loading branch information
piyush kumar sadangi authored and romani committed Sep 2, 2024
1 parent c7cedf2 commit cf2f17e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ public void testExample1() throws Exception {
@Test
public void testExample2() throws Exception {
final String[] expected = {
"1:3: " + getCheckMessage(MSG_KEY, "(TODO)|(FIXME)"),
"18:14: " + getCheckMessage(MSG_KEY, "(TODO)|(FIXME)"),
"20:14: " + getCheckMessage(MSG_KEY, "(TODO)|(FIXME)"),
"1:3: " + getCheckMessage(MSG_KEY, "(?i)(TODO)|(FIXME)"),
"18:14: " + getCheckMessage(MSG_KEY, "(?i)(TODO)|(FIXME)"),
"19:14: " + getCheckMessage(MSG_KEY, "(?i)(TODO)|(FIXME)"),
"20:14: " + getCheckMessage(MSG_KEY, "(?i)(TODO)|(FIXME)"),
};

verifyWithInlineConfigParser(getPath("Example2.java"), expected);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module name="Checker">
<module name="TreeWalker">
<module name="TodoComment">
<property name="format" value="(TODO)|(FIXME)"/>
<property name="format" value="(?i)(TODO)|(FIXME)"/>
</module>
</module>
</module>
Expand All @@ -16,7 +16,7 @@ public class Example2 {
int x;
public void test() {
i++; // TODO: do differently in future // violation
i++; // todo: do differently in future
i++; // todo: do differently in future // violation
i=i/x; // FIXME: handle x = 0 case // violation
i=i/x; // FIX : handle x = 0 case
}
Expand Down
4 changes: 2 additions & 2 deletions src/xdocs/checks/misc/todocomment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public class Example1 {
&lt;module name=&quot;Checker&quot;&gt;
&lt;module name=&quot;TreeWalker&quot;&gt;
&lt;module name=&quot;TodoComment&quot;&gt;
&lt;property name=&quot;format&quot; value=&quot;(TODO)|(FIXME)&quot;/&gt;
&lt;property name=&quot;format&quot; value=&quot;(?i)(TODO)|(FIXME)&quot;/&gt;
&lt;/module&gt;
&lt;/module&gt;
&lt;/module&gt;
Expand All @@ -95,7 +95,7 @@ public class Example2 {
int x;
public void test() {
i++; // TODO: do differently in future // violation
i++; // todo: do differently in future
i++; // todo: do differently in future // violation
i=i/x; // FIXME: handle x = 0 case // violation
i=i/x; // FIX : handle x = 0 case
}
Expand Down

0 comments on commit cf2f17e

Please sign in to comment.