<ruleset xmlns="http://codenarc.org/ruleset/1.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://codenarc.org/ruleset/1.0 http://codenarc.org/ruleset-schema.xsd"
         xsi:noNamespaceSchemaLocation="http://codenarc.org/ruleset-schema.xsd">

    <description>MongoDB Java driver rule set</description>

    <ruleset-ref path='rulesets/imports.xml'>
        <rule-config name='MisorderedStaticImports'>
            <property name='comesBefore' value='false'/>
        </rule-config>
        <rule-config name='NoWildcardImports'>
            <property name='doNotApplyToFilesMatching' value='AsynchronousChannelHelperSmokeTestSpecification.groovy'/>
        </rule-config>
    </ruleset-ref>

    <ruleset-ref path='rulesets/basic.xml'>
        <exclude name="ComparisonWithSelf"/>
    </ruleset-ref>
    <ruleset-ref path='rulesets/braces.xml'/>
    <ruleset-ref path='rulesets/concurrency.xml'/>
    <ruleset-ref path='rulesets/convention.xml'>
        <rule-config name='NoDef'>
            <property name='doNotApplyToFilesMatching' value='.*Specification.groovy'/>
        </rule-config>
    </ruleset-ref>
    <ruleset-ref path='rulesets/design.xml'>
        <rule-config name='BuilderMethodWithSideEffects'>
            <property name='methodNameRegex' value='create.*|build.*'/>
        </rule-config>
        <rule-config name='Instanceof'>
            <property name='doNotApplyToFilesMatching' value='.*Specification.groovy'/>
        </rule-config>
    </ruleset-ref>
    <ruleset-ref path='rulesets/dry.xml'>
        <rule-config name='DuplicateListLiteral'>
            <property name='doNotApplyToFilesMatching' value='.*Specification.groovy'/>
        </rule-config>
        <exclude name="DuplicateNumberLiteral"/>
        <exclude name="DuplicateStringLiteral"/>
        <exclude name="DuplicateMapLiteral"/>
    </ruleset-ref>
    <ruleset-ref path='rulesets/exceptions.xml'/>
    <ruleset-ref path='rulesets/formatting.xml'>
        <rule-config name='LineLength'>
            <property name='length' value='140'/>
        </rule-config>
        <!-- this check is failing '})' when it shouldn't -->
        <exclude name='SpaceAfterClosingBrace'/>
        <exclude name='SpaceBeforeOpeningBrace'/>
        <exclude name='SpaceAroundMapEntryColon'/>
        <exclude name='ClassJavadoc'/>
        <exclude name='BlankLineBeforePackage'/>
        <exclude name='ConsecutiveBlankLines'/>
        <exclude name='FileEndsWithoutNewline'/>
    </ruleset-ref>
    <ruleset-ref path='rulesets/generic.xml'/>
    <ruleset-ref path='rulesets/groovyism.xml'>
        <exclude name="ExplicitCallToAndMethod"/>
        <exclude name="ExplicitCallToEqualsMethod"/>
        <exclude name="ExplicitCallToCompareToMethod"/>
        <exclude name='GetterMethodCouldBeProperty'/>
     </ruleset-ref>
    <ruleset-ref path='rulesets/junit.xml'/>
    <ruleset-ref path='rulesets/logging.xml'/>
    <ruleset-ref path='rulesets/naming.xml'>
        <exclude name='MethodName'/>
        <exclude name='FactoryMethodName'/>
    </ruleset-ref>
    <ruleset-ref path='rulesets/security.xml'/>
    <ruleset-ref path='rulesets/serialization.xml'/>
    <ruleset-ref path='rulesets/size.xml'>
        <rule-config name='MethodCount'>
            <property name='doNotApplyToFilesMatching' value='.*Specification.groovy'/>
        </rule-config>
        <rule-config name='ParameterCount'>
            <property name='doNotApplyToFilesMatching' value='.*Specification.groovy'/>
        </rule-config>
        <exclude name='CrapMetric'/>
        <exclude name='AbcMetric'/>
        <exclude name='MethodSize'/>
    </ruleset-ref>
    <ruleset-ref path='rulesets/unnecessary.xml'>
        <!-- these should be revisted later when we've developed a Groovy style -->
        <exclude name='UnnecessaryGetter'/>
        <exclude name='UnnecessarySemicolon'/>
        <!-- dangerous rule because if you use "with in a then clause of a Spock test, the assertions are not run -->
        <exclude name="UnnecessaryObjectReferences"/>
    </ruleset-ref>
    <ruleset-ref path='rulesets/unused.xml'>
        <rule-config name='UnusedObject'>
            <property name='doNotApplyToFilesMatching' value='.*Specification.groovy'/>
        </rule-config>
    </ruleset-ref>

</ruleset>

