Hello all,

I am looking for some help in setting up a custom codenarc rule that works
with the codenarc code-quality plugin.

My build.gradle has the following instruction: 

codeNarcConfigFileName = 'config/codenarc/rules.groovy'

My rules.groovy file looks like this:

ruleset {
    description 'Rules Sample Groovy Gradle Project'

    ruleset('rulesets/basic.xml')
    ruleset('rulesets/braces.xml')
    ruleset('rulesets/exceptions.xml')
    ruleset('rulesets/imports.xml')
    ruleset('rulesets/logging.xml') {
        'Println' priority: 1
        'PrintStackTrace' priority: 1
    }
    ruleset('rulesets/naming.xml') {
                'ClassName' {
                        enabled = false
                }
        }
    ruleset('rulesets/unnecessary.xml') {
        'UnnecessaryReturnKeyword' {
            enabled = false
        }
    }

    ruleset('rulesets/unused.xml')

    rule('MyCustomRuleScript.groovy')
}

The codenarcMain task executes successfully without the last instruction,
however adding the 

rule('MyCustomRuleScript.groovy')

instruction is giving me problems. I can't seem to find a place to stick
MyCustomRuleScript.groovy in my project so that the plugin will find it and
not throw java.io.FileNotFoundException.

The codenarc documentation states "By default, the paths specified are
relative to the classpath. But these paths may be optionally prefixed by any
of the valid java.net.URL prefixes..." however I've tried various locations,
and various prefixes to the instruction in rules.groovy, all with no luck.

Any help would be much appreciated.

Regards,
Adam Wilmore

-- 
View this message in context: 
http://gradle.1045684.n5.nabble.com/code-quality-plugin-location-of-custom-codenarc-rule-tp3373768p3373768.html
Sent from the gradle-user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to