Re: [Codenarc-user] Picking up codenarc.properties from Ant task
Brought to you by:
chrismair
From: <chr...@we...> - 2011-08-15 17:15:29
|
Is the project root definitely in the classpath? I would probably assume not, by default. (from the online docs) You can optionally override the location of the properties file by setting the "codenarc.properties.file" system property to the path or URL of the properties file. That can include a "file:" URL to load from a relative or absolute path on the filesystem (e.g., "file:relative/path/override-codenarc.properties"). If the properties file is not found, then do nothing. So, either add the project root to the classpath, or try setting the "codenarc.properties.file" system property to something like "file:codenarc.properties" (assuming that the project root is the current working dir). Chris -----Original Message----- From: Steven Sproat [mailto:sp...@gm...] Sent: Monday, August 15, 2011 11:04 AM To: cod...@li... Subject: [Codenarc-user] Picking up codenarc.properties from Ant task Hi all, Many thanks for this great tool, we're using it in our Jenkins CI environment with the violations plugin for nice reporting on possible defects. However, I'm having an issue with not being able to disable some rules that we don't particularly care about, and is causing errors to be reported that we just want to ignore. Given a codenarc.properties file, located in the project root (a grails application) with the following contents: ExplicitArrayListInstantiation.enabled=false and this build.xml -- <project name="myProject"> <taskdef name="codenarc" classname="org.codenarc.ant.CodeNarcTask" /> <target name="codenarc"> <codenarc ruleSetFiles="rulesets/basic.xml, rulesets/braces.xml, rulesets/imports.xml, rulesets/unused.xml" maxPriority1Violations="0"> <fileset dir="src" includes="**/*.groovy" /> <fileset dir="grails-app" includes="**/*.groovy" /> <fileset dir="test" includes="**/*.groovy" /> <report type="xml"> <option name="outputFile" value="test/reports/CodeNarcAntReport.xml" /> </report> <report type="html"> <option name="outputFile" value="test/reports/CodeNarcAntReport.html" /> <option name="title" value="project Groovy Code Analysis" /> </report> </codenarc> </target> </project> ...I am still getting errors about this explicitly instantiating arraylists. I'm unsure how to get the codenarc.properties file to be "picked up" by CodeNarc. I would use the Grails CodeNarc plugin, but unfortunately it's for Grails 1.3+ and this project is Grails 1.1 based. Any pointers or advice would be greatly appreciated. Regards, Steven Sproat -- -- Steven Sproat, BSc http://www.whyteboard.org/ ------------------------------------------------------------------------------ uberSVN's rich system and user administration capabilities and model configuration take the hassle out of deploying and managing Subversion and the tools developers use with it. Learn more about uberSVN and get a free download at: http://p.sf.net/sfu/wandisco-dev2dev _______________________________________________ Codenarc-user mailing list Cod...@li... https://lists.sourceforge.net/lists/listinfo/codenarc-user |