<commit_before>/*
 * Copyright 2012 Netflix, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
ruleset {

    description 'Asgard RuleSet containing all CodeNarc Rules, grouped by category.'

//    rule('file:test/unit/com/netflix/asgard/codenarc/ExplicitCallToSpringAutoWire.groovy') {
//        description = 'Use of Spring.autowire(...) can become unstable.'
//    }

    // rulesets/basic.xml
    AssertWithinFinallyBlock
    AssignmentInConditional
    BigDecimalInstantiation
    BitwiseOperatorInConditional
    BooleanGetBoolean
    BrokenNullCheck
    BrokenOddnessCheck
    ClassForName
    ComparisonOfTwoConstants
//    ComparisonWithSelf
    ConstantAssertExpression
    ConstantIfExpression
    ConstantTernaryExpression
    DeadCode
    DoubleNegative
    DuplicateCaseStatement
    DuplicateMapKey
    DuplicateSetValue
//    EmptyCatchBlock
    EmptyElseBlock
    EmptyFinallyBlock
    EmptyForStatement
    EmptyIfStatement
    EmptyInstanceInitializer
//    EmptyMethod
    EmptyStaticInitializer
    EmptySwitchStatement
    EmptySynchronizedStatement
    EmptyTryBlock
    EmptyWhileStatement
    EqualsAndHashCode
    EqualsOverloaded
    ExplicitGarbageCollection
    ForLoopShouldBeWhileLoop
    HardCodedWindowsFileSeparator
    HardCodedWindowsRootDirectory
    IntegerGetInteger
    RandomDoubleCoercedToZero
    RemoveAllOnSelf
    ReturnFromFinallyBlock
    ThrowExceptionFromFinallyBlock

    // rulesets/braces.xml
    ElseBlockBraces
    ForStatementBraces
//    IfStatementBraces
    WhileStatementBraces

    // rulesets/concurrency.xml
    BusyWait
    DoubleCheckedLocking
    InconsistentPropertyLocking
    InconsistentPropertySynchronization
    NestedSynchronization
    StaticCalendarField
    StaticConnection
    StaticDateFormatField
    StaticMatcherField
    StaticSimpleDateFormatField
    SynchronizedMethod
    SynchronizedOnBoxedPrimitive
    SynchronizedOnGetClass
    SynchronizedOnReentrantLock
    SynchronizedOnString
    SynchronizedOnThis
    SynchronizedReadObjectMethod
    SystemRunFinalizersOnExit
    ThreadGroup
    ThreadLocalNotStaticFinal
    ThreadYield
    UseOfNotifyMethod
    VolatileArrayField
    VolatileLongOrDoubleField
    WaitOutsideOfWhileLoop

    // rulesets/convention.xml
    ConfusingTernary
//    CouldBeElvis
    HashtableIsObsolete
//    InvertedIfElse
    LongLiteralWithLowerCaseL
//    ParameterReassignment
    TernaryCouldBeElvis
    VectorIsObsolete

    // rulesets/design.xml
//    AbstractClassWithPublicConstructor  // nothing wrong with this
//    AbstractClassWithoutAbstractMethod  // nothing wrong with this
    BooleanMethodReturnsNull
//    BuilderMethodWithSideEffects
    CloneableWithoutClone
    CloseWithoutCloseable
    CompareToWithoutComparable
    ConstantsOnlyInterface
//    EmptyMethodInAbstractClass  // nothing wrong with this
    FinalClassWithProtectedMember
    ImplementationAsType
//    PrivateFieldCouldBeFinal
    PublicInstanceField
    ReturnsNullInsteadOfEmptyArray
    ReturnsNullInsteadOfEmptyCollection
    SimpleDateFormatMissingLocale
    StatelessSingleton

    // rulesets/dry.xml
//    DuplicateListLiteral
//    DuplicateMapLiteral
//    DuplicateNumberLiteral
//    DuplicateStringLiteral

    // rulesets/exceptions.xml
    CatchArrayIndexOutOfBoundsException
    CatchError
//    CatchException
    CatchIllegalMonitorStateException
    CatchIndexOutOfBoundsException
//    CatchNullPointerException
    CatchRuntimeException
    CatchThrowable
    ConfusingClassNamedException
    ExceptionExtendsError
    MissingNewInThrowStatement
//    ReturnNullFromCatchBlock
    SwallowThreadDeath
    ThrowError
    ThrowException
//    ThrowNullPointerException
    ThrowRuntimeException
    ThrowThrowable

    // rulesets/formatting.xml
    BracesForClass
    BracesForForLoop
    BracesForIfElse
    BracesForMethod
    BracesForTryCatchFinally
    ClassJavadoc
//    LineLength

    // rulesets/generic.xml
    IllegalClassReference
    IllegalPackageReference
    IllegalRegex
    RequiredRegex
    RequiredString
    StatelessClass

    // rulesets/grails.xml
//    GrailsDomainHasEquals
//    GrailsDomainHasToString
    GrailsPublicControllerMethod {
        priority = 1
    }
    GrailsServletContextReference
    GrailsSessionReference
//    GrailsStatelessService

    // rulesets/groovyism.xml
//    AssignCollectionSort
    AssignCollectionUnique
//    ClosureAsLastMethodParameter
    CollectAllIsDeprecated
    ConfusingMultipleReturns<commit_msg>removing the CodeNarc check for public methods in a controller This was in place to protect us from methods that were inadvertently public in preparation for a Grails 2 upgrade where they would become visible actions. The rule should be suppressed now that we are in Grails 2 and using methods for actions is preferred.<commit_after>/*
 * Copyright 2012 Netflix, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
ruleset {

    description 'Asgard RuleSet containing all CodeNarc Rules, grouped by category.'

//    rule('file:test/unit/com/netflix/asgard/codenarc/ExplicitCallToSpringAutoWire.groovy') {
//        description = 'Use of Spring.autowire(...) can become unstable.'
//    }

    // rulesets/basic.xml
    AssertWithinFinallyBlock
    AssignmentInConditional
    BigDecimalInstantiation
    BitwiseOperatorInConditional
    BooleanGetBoolean
    BrokenNullCheck
    BrokenOddnessCheck
    ClassForName
    ComparisonOfTwoConstants
//    ComparisonWithSelf
    ConstantAssertExpression
    ConstantIfExpression
    ConstantTernaryExpression
    DeadCode
    DoubleNegative
    DuplicateCaseStatement
    DuplicateMapKey
    DuplicateSetValue
//    EmptyCatchBlock
    EmptyElseBlock
    EmptyFinallyBlock
    EmptyForStatement
    EmptyIfStatement
    EmptyInstanceInitializer
//    EmptyMethod
    EmptyStaticInitializer
    EmptySwitchStatement
    EmptySynchronizedStatement
    EmptyTryBlock
    EmptyWhileStatement
    EqualsAndHashCode
    EqualsOverloaded
    ExplicitGarbageCollection
    ForLoopShouldBeWhileLoop
    HardCodedWindowsFileSeparator
    HardCodedWindowsRootDirectory
    IntegerGetInteger
    RandomDoubleCoercedToZero
    RemoveAllOnSelf
    ReturnFromFinallyBlock
    ThrowExceptionFromFinallyBlock

    // rulesets/braces.xml
    ElseBlockBraces
    ForStatementBraces
//    IfStatementBraces
    WhileStatementBraces

    // rulesets/concurrency.xml
    BusyWait
    DoubleCheckedLocking
    InconsistentPropertyLocking
    InconsistentPropertySynchronization
    NestedSynchronization
    StaticCalendarField
    StaticConnection
    StaticDateFormatField
    StaticMatcherField
    StaticSimpleDateFormatField
    SynchronizedMethod
    SynchronizedOnBoxedPrimitive
    SynchronizedOnGetClass
    SynchronizedOnReentrantLock
    SynchronizedOnString
    SynchronizedOnThis
    SynchronizedReadObjectMethod
    SystemRunFinalizersOnExit
    ThreadGroup
    ThreadLocalNotStaticFinal
    ThreadYield
    UseOfNotifyMethod
    VolatileArrayField
    VolatileLongOrDoubleField
    WaitOutsideOfWhileLoop

    // rulesets/convention.xml
    ConfusingTernary
//    CouldBeElvis
    HashtableIsObsolete
//    InvertedIfElse
    LongLiteralWithLowerCaseL
//    ParameterReassignment
    TernaryCouldBeElvis
    VectorIsObsolete

    // rulesets/design.xml
//    AbstractClassWithPublicConstructor  // nothing wrong with this
//    AbstractClassWithoutAbstractMethod  // nothing wrong with this
    BooleanMethodReturnsNull
//    BuilderMethodWithSideEffects
    CloneableWithoutClone
    CloseWithoutCloseable
    CompareToWithoutComparable
    ConstantsOnlyInterface
//    EmptyMethodInAbstractClass  // nothing wrong with this
    FinalClassWithProtectedMember
    ImplementationAsType
//    PrivateFieldCouldBeFinal
    PublicInstanceField
    ReturnsNullInsteadOfEmptyArray
    ReturnsNullInsteadOfEmptyCollection
    SimpleDateFormatMissingLocale
    StatelessSingleton

    // rulesets/dry.xml
//    DuplicateListLiteral
//    DuplicateMapLiteral
//    DuplicateNumberLiteral
//    DuplicateStringLiteral

    // rulesets/exceptions.xml
    CatchArrayIndexOutOfBoundsException
    CatchError
//    CatchException
    CatchIllegalMonitorStateException
    CatchIndexOutOfBoundsException
//    CatchNullPointerException
    CatchRuntimeException
    CatchThrowable
    ConfusingClassNamedException
    ExceptionExtendsError
    MissingNewInThrowStatement
//    ReturnNullFromCatchBlock
    SwallowThreadDeath
    ThrowError
    ThrowException
//    ThrowNullPointerException
    ThrowRuntimeException
    ThrowThrowable

    // rulesets/formatting.xml
    BracesForClass
    BracesForForLoop
    BracesForIfElse
    BracesForMethod
    BracesForTryCatchFinally
    ClassJavadoc
//    LineLength

    // rulesets/generic.xml
    IllegalClassReference
    IllegalPackageReference
    IllegalRegex
    RequiredRegex
    RequiredString
    StatelessClass

    // rulesets/grails.xml
//    GrailsDomainHasEquals
//    GrailsDomainHasToString
//    GrailsPublicControllerMethod
    GrailsServletContextReference
    GrailsSessionReference
//    GrailsStatelessService

    // rulesets/groovyism.xml
//    AssignCollectionSort
    AssignCollectionUnique
//    ClosureAsLastMethodParameter
    CollectAllIsDeprecated
    ConfusingMultipleReturns
{'fraction_non_alphanumeric': 0.036203047656022516, 'fraction_numerical': 0.0018441230709502086, 'mean_word_length': 3.5472197705207416, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 22}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '115441', 'n_tokens_mistral': 2762, 'n_tokens_neox': 2622, 'n_words': 587}