#701 Rule "Comment pattern matcher" (TodoCommentCheck) should not search for pattern in Javadoc comments

release_1.0
closed
nobody
None
3
2014-02-09
2013-07-10
Andreas Galek
No

We use the Checkstyle rule "Comment pattern matcher" to search for different markers in Java comments.

Unfortunately, the rule also searches in Javadoc comments, Sonar reports them as violations, too. It leads to problems in our CI environment. Our source code management system writes file history at the end of Java file, as Javadoc comment. If the developer used the pattern word while checking in the file to SCM then the pattern appears later in Javadoc comment section at the end of the file.

The bug-fix should limit the search scope of the rule "Comment pattern matcher" to only Java comments.

Discussion

  • Roman Ivanov
    Roman Ivanov
    2013-10-05

    I do not understant what Checks you reference to, I presume it is http://checkstyle.sourceforge.net/config_misc.html#TodoComment, so please read carefully .... "Actually it is a generic regular expression matcher on Java comments.", so make your regexp that clever to distinguish that cases.

     
    • Andreas Galek
      Andreas Galek
      2013-10-07

      Hi Roman,

      what I mean is the following false-positive case:

      /**
      History:

      TODO comment removed from code to avoid Sonar complainings.
      */

       
      Last edit: Andreas Galek 2013-10-07
      • Roman Ivanov
        Roman Ivanov
        2013-10-07

        yes, it will not be supported from our side, as Java comments are not part of Tree stucture (AST) that we use in all Checks. So you/we have only regexp abilities.

         
  • Roman Ivanov
    Roman Ivanov
    2013-10-05

    • status: open --> closed