Menu

#1265 Allow //NOPMD without trailing comment

New Tickets
open
nobody
None
PMD
3-Major
Feature-Request
2017-12-26
2014-09-23
Sourceward
No

Marking a certain line of code as reviewed, works by adding //NOPMD as a trailing comment. According to other code analysis tools (e.g. checkstyle) and my personal opinion, trailing comments are bad practice.

I'd prefer to have the NOPMD-annotaion in an extra line, e.g.

// NOPMD:
System.out.println("Important");

instead of:

System.out.println("Important"); // NOPMD

Discussion

  • Andreas Dangel

    Andreas Dangel - 2014-09-28
    • Type: Bug --> Feature-Request
     
  • TWiStErRob

    TWiStErRob - 2017-12-26

    A workaround is to configure CheckStyle to allow this, but I agree with the issue.

    <module name="TrailingComment">
        <property name="legalComment" value="^NOPMD .*$"/>
    </module>
    

    https://stackoverflow.com/a/26000122/253468

     

Log in to post a comment.