import org.codenarc.rule.generic.RequiredStringRule

ruleset {
    description 'RuleSet for running CodeNarc against the project source code. See RunCodeNarcAgainstProjectSourceCodeTest'

    ruleset('rulesets/basic.xml')

    ruleset('rulesets/braces.xml')

    ruleset('rulesets/convention.xml') {
        exclude 'NoDef'
    }

    ruleset('rulesets/design.xml')

    ruleset('rulesets/dry.xml') {
        include 'DuplicateMapLiteral'
    }
    ruleset('rulesets/exceptions.xml')

    ruleset('rulesets/groovyism.xml')

    ruleset('rulesets/formatting.xml')

    ruleset('rulesets/imports.xml')

    ruleset('rulesets/junit.xml') {
        exclude 'JUnitStyleAssertions'
    }
    ruleset('rulesets/logging.xml')

    ruleset('rulesets/naming.xml')

    ruleset('rulesets/size.xml') {
        exclude 'CrapMetric'
    }

    ruleset('rulesets/unnecessary.xml') {
        exclude 'UnnecessaryGetter'
        exclude 'UnnecessaryObjectReferences'
        exclude 'UnnecessaryReturnKeyword'
    }

    ruleset('rulesets/unused.xml')

    // Ensure that each source file contains the Apache License header
    rule(RequiredStringRule) {
        name = 'ApacheLicenseRequired'
        string = 'Licensed under the Apache License, Version 2.0 (the "License");'
        violationMessage = 'The Apache License 2.0 comment is missing from the source file'
        description = 'Checks that all source files contain the Apache License 2.0 comment'
    }

}