Checkstyle task should check also test code

Stephen McConnell mcconnell at dpml.net
Sat Jan 7 10:37:58 EST 2006


 

> -----Original Message-----
> From: dev-dpml-bounces at lists.ibiblio.org 
> [mailto:dev-dpml-bounces at lists.ibiblio.org] On Behalf Of Carel Paradis
> Sent: Saturday, 7 January 2006 12:27 PM
> To: DPML Development
> Subject: Re: Checkstyle task should check also test code
> 
> Hi Steve,
> 
> I checked the CheckstyleTask code to see if I can add the 
> feature to optionally check the style of test code. I can add 
> a task attribute to enable checking the test code. However, I 
> don't like this option  because if in the future we want to 
> check the style in a third path, then we need to add another 
> attribute. In order to check the test code style without 
> modifying the CheckstyleTask, I have modified my 
> standard.template like
> this:
> 
>   <target name="checkstyle" depends="prepare">
>     <property name="checkstyle.dir" 
> location="${project.target.reports.dir}/checkstyle"/>
>     <property name="checkstyle.data" 
> location="${checkstyle.dir}/checkstyle.xml"/>
>     <property name="project.checkstyle.data" 
> location="${project.target.reports.dir}/checkstyle"/>
>     <x:plugin
> uri="artifact:plugin:dpml/depot/dpml-depot-checkstyle#SNAPSHOT">
>       <task class="net.dpml.tools.checkstyle.CheckstyleTask" 
> name="checkstyle"/>
>     </x:plugin>
>     <mkdir dir="${checkstyle.dir}"/>
>     <checkstyle>
>       <formatter type="xml" toFile="${checkstyle.data}"/>
>       <fileset dir=".">
>         <include name="**/target/build/test/**/*.java"/>
>       </fileset>
>     </checkstyle>
>     <xslt style="${dpml.prefs}/dpml/tools/xsls/checkstyle-frames.xsl"
>         in="${checkstyle.data}"
>         out="${checkstyle.dir}/checkstyle_report.html" />
>   </target>
> 
> You can see that I have added a fileset that take all files 
> that satisfy the pattern "**/target/build/test/**/*.java".
>
> I think the best solution is to create a specialized kind of 
> fileset. This one should build a fileset as it is done into 
> the CheckstyleTask. This means creating a fileset relative to 
> a project (instead of relative to a directory). There are 
> many standard and non standard Ant tasks that work already 
> properly with fileset. If we can provide specialize fileset 
> then we will be able to reuse all these tasks.
> 
> What do you think?

I agree that the custom project-based fileset is the way to go - but I also
need to take a look at the base checkstyle task to see to what extent we can
define out our stuff.  Based on comments on the Ant dev and user mailing
lists it looks like there will be a lot more potential for customization of
selectors under Ant 1.7 - also need to check potential under the current Ant
version (as several 1.7 features are already in place under 1.6.5).

/Steve.




More information about the dev-dpml mailing list