support for ant selectors

13 views
Skip to first unread message

David M

unread,
Feb 21, 2015, 5:51:38 PM2/21/15
to check...@googlegroups.com
Hello,

We recently started implementing checkstyle in our project, so far it's worked great. However, since our project is rather large, it takes about 3 minutes to run checkstyle on all 13000+ java files :-/ we run checkstyle on our CI server, but it would be better for developers to be able to run it locally without having to check files that they didn't modify. I know the best solution is to modularize our project (and we have that in our roadmap) but for now I was exploring using ant selectors, e.g

<target name="checkstyle">                                      
 
<checkstyle config="checkstyle.xml">
   
<fileset dir="..." includes="**/*.java">
     
<modified/>
   
</fileset>
 
</checkstyle>
</target>

This should in theory run checkstyle only on files that have been modified. The problem is that when I add that, checkstyle finds no files in the fileset
checkstyle:

[checkstyle] Running Checkstyle 6.3 on 0 files

Would it be possible, or useful to support selectors in checkstyle? If so, it would need to remove fails with failures from the cache so subsequent runs continue to test those...

Thanks in advance!

Roman Ivanov

unread,
Feb 21, 2015, 7:32:35 PM2/21/15
to David M, check...@googlegroups.com
Hi David,

please review checkstyle.cache.file option in Checkstyle - http://checkstyle.sourceforge.net/anttask.html#Examples

It might be what you are looking at.

please participate in 1 question survey - https://t.co/kvs57tuPPK to let us know what should be focus in 2015 development

thanks,
Roman Ivanov

--
You received this message because you are subscribed to the Google Groups "checkstyle" group.
To unsubscribe from this group and stop receiving emails from it, send an email to checkstyle+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David M

unread,
Feb 22, 2015, 12:16:57 AM2/22/15
to check...@googlegroups.com, dalb...@gmail.com
Thanks for the information. However, it doesn't reduce execution time much because we have a bunch of files in the list of suppressions and it seems like those are not getting added to the cache. I was looking at TreeWalker.java and it looks like even when certain suppressions are applied to a file, the errors are still listed in getMessageCollector - does that seem accurate?

Thanks,

David M

unread,
Feb 22, 2015, 1:20:48 AM2/22/15
to check...@googlegroups.com
I found this reported issue, https://github.com/checkstyle/checkstyle/issues/407, I think that's what I'm encountering. Thanks.

Roman Ivanov

unread,
Feb 24, 2015, 11:46:16 PM2/24/15
to David M, check...@googlegroups.com
Hi David,

yes we are not accurate with cache :

I will put a focus on that in 6.5 (release at end of March).

I connection to your original question .... I am not good at ANT not sure how to do a trick by mean of ant.

thanks,
Roman Ivanov
Reply all
Reply to author
Forward
0 new messages