#137 Don't apply GenericIllegalRegexp on comments

release_3.4
closed
Check (274)
3
2012-10-10
2003-02-05
No

Hi.

I think GenericIllegalRegexp should not be applied to
comments.
Example config:
<module name="GenericIllegalRegexp">
<property name="format" value="System.exit" />
</module>

Example file:
if (line.equals("ant")) {
// Known Problem: start() invokes System.exit().
// The problem appears on invocation of main() as
well as on invocation of start().
org.apache.tools.ant.Main.start(new String[0],
null, null);
} else if (line.equals("exit")) {
return;
}

Currently, GenericIllegalRegexp complains about the
string "System.exit", though it is in a comment and
therefor no problem.

So I request that GenericIllegalRegexp is not applied
on comments, or even better, it's configurable wether a
Regexp should apply on comments or not, without the
need of writing a Regexp for the comment.

Bye

Discussion

  • Bill Schneider

    Bill Schneider - 2003-05-22

    Logged In: YES
    user_id=768885

    related to #740694 which would apply a regular expression
    only to string literals.

     
  • Lars Kühne

    Lars Kühne - 2004-02-29

    Logged In: YES
    user_id=401384

    This feature has been implemented (contribution by Daniel
    Grenner) and will be available in version 3.4: new
    GenericIllegalRegexp option "ignoreComments"

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks