Search code examples
javaantsimian

Set up ignore block comments for Simian Ant Task


Is it possible to set up start and end comments for disabling simian in an Ant task? I've seen various forums talking about a command line option to disable simian for certain blocks of code using comments and I have tried this in the Ant task doing something like this:

<simian ignoreBlocks="simian-start:simian-stop" .... />

And then in the Java code, I have done the following

//simian-start
....
//simian-stop

However, the duplication is still detected between the bit of code between the comments above and the other class that has the same bit of code.

I also tried it the other way around just in case I have the ordering of the ignoreBlocks mixed up:

//simian-stop
....
//simian-start

Solution

  • I've got it working just like you described. I am using simian 2.2.24. The command line call

    java -jar ~/tmp/simian-2.2.24/simian-2.2.24.jar -ignoreBlocks="simian-off:simian-on" test.java
    

    does not find code like this:

    //simian-off
    foo.bar();
    //simian-on
    

    Setting the ignoreBlocks attribute in the ant task the same way

    <simian language="java" ignoreBlocks="simian-off:simian-on">
    ...
    </simian>
    

    also does not find the code.

    Hth