File: codenarc.groovy

package info (click to toggle)
libgpars-groovy-java 1.2.1-11
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 14,852 kB
  • sloc: java: 29,729; xml: 156; sh: 136; makefile: 9
file content (129 lines) | stat: -rw-r--r-- 6,547 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
 * Copyright 2010-2011 the original author or authors.
 *
 * 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 {
    ruleset('rulesets/imports.xml')

    ruleset('rulesets/naming.xml') {
        exclude 'PropertyName'
        exclude 'PackageName'   // TODO is plugAndPlay package correct? 
        'ClassName' {
            regex = '.*'  // '^[A-Z][a-zA-Z0-9]*$'   // TODO: refine correct regex
        }
        'FieldName' {
            finalRegex = '.*' // '^_?[a-z][a-zA-Z0-9]*$'        // TODO: refine correct regex
            staticFinalRegex = '.*' //  '^[A-Z][A-Z_0-9]*$'     // TODO: refine correct regex
        }
        'MethodName' {
            regex = '.*'  // '^[a-z][a-zA-Z0-9_]*$'     // TODO: refine correct regex
        }
        'VariableName' {
            regex = '.*' // '^_?[a-z][a-zA-Z0-9]*$'    // TODO: refine correct regex
            finalRegex = '.*' // '^_?[a-z][a-zA-Z0-9]*$'    // TODO: refine correct regex
        }
    }

    ruleset('rulesets/grails.xml')

    ruleset('rulesets/logging.xml') {
        exclude 'Println'       //TODO: Fix the code and enable rule
        exclude 'PrintStackTrace'    //TODO: Fix the code and enable rule
        exclude 'SystemErrPrint'    //TODO: Fix the code and enable rule
    }

    ruleset('rulesets/braces.xml') {
        exclude 'IfStatementBraces'    // TODO: analyze usage and verify correct code 
        exclude 'WhileStatementBraces'    //TODO: analyze usage and verify correct code 
        exclude 'ElseBlockBraces'    //TODO: analyze usage and verify correct code 
        exclude 'ForStatementBraces'    //TODO: analyze usage and verify correct code 
    }

    ruleset('rulesets/basic.xml') {
        exclude 'StringInstantiation'   //TODO: Fix the code and enable rule
        exclude 'ExplicitHashSetInstantiation'          //TODO: Fix the code and enable rule
        exclude 'ExplicitLinkedListInstantiation'          //TODO: Fix the code and enable rule
        exclude 'ExplicitGarbageCollection'          //TODO: Fix the code and enable rule
        exclude 'ExplicitArrayListInstantiation'          //TODO: Fix the code and enable rule
        exclude 'EmptyCatchBlock'    //TODO: Fix the code and enable rule
        exclude 'EmptyWhileStatement'    //TODO: Fix the code and enable rule
        exclude 'ConfusingTernary'    //TODO: Fix the code and enable rule
        exclude 'ExplicitCallToEqualsMethod'    //TODO: Fix the code and enable rule
        exclude 'ExplicitCallToPlusMethod'    //TODO: Fix the code and enable rule
        exclude 'DeadCode'    //TODO: Fix the code and enable rule
    }

    ruleset('rulesets/size.xml') {
        exclude 'AbcComplexity'    //TODO: Fix the code and enable rule
        exclude 'MethodCount'    //TODO: Fix the code and enable rule
        exclude 'ClassSize'    //TODO: Fix the code and enable rule
        exclude 'NestedBlockDepth'    //TODO: Fix the code and enable rule
    }

    ruleset('rulesets/junit.xml') {
        exclude 'JUnitStyleAssertions'       //TODO: Fix the code and enable rule
        exclude 'JUnitSetUpCallsSuper'       //TODO: Fix the code and enable rule
        exclude 'JUnitTearDownCallsSuper'       //TODO: Fix the code and enable rule
        exclude 'UseAssertTrueInsteadOfAssertEquals' //TODO: Fix the code and enable rule
        exclude 'UseAssertNullInsteadOfAssertEquals' //TODO: Fix the code and enable rule
        exclude 'JUnitPublicNonTestMethod' //TODO: Fix the code and enable rule
        exclude 'JUnitTestMethodWithoutAssert' //TODO: Fix the code and enable rule
        exclude 'UseAssertEqualsInsteadOfAssertTrue' //TODO: Fix the code and enable rule	
        exclude 'JUnitUnnecessarySetUp' //TODO: Fix the code and enable rule	
        exclude 'JUnitUnnecessaryTearDown' //TODO: Fix the code and enable rule	
    }

    ruleset('rulesets/concurrency.xml') {
        exclude 'SynchronizedMethod'         //TODO: Fix the code and enable rule
        exclude 'ThreadYield'         //TODO: Fix the code and enable rule
        exclude 'NestedSynchronization'         //TODO: Fix the code and enable rule
    }

    ruleset('rulesets/unnecessary.xml') {
//        exclude 'UnnecessaryCollectCall'    //TODO: Fix the code and enable rule
//        exclude 'UnnecessaryConstructor'    //TODO: Fix the code and enable rule
//        exclude 'UnnecessaryReturnKeyword'   //TODO: Fix the code and enable rule
        exclude 'UnnecessaryGetter'   //TODO: Fix the code and enable rule
        exclude 'UnnecessaryObjectReferences'   //TODO: this may be a bug in a codenarc rule
        exclude 'UnnecessaryStringInstantiation'   //TODO: Fix the code and enable rule
        exclude 'UnnecessaryOverridingMethod'   //TODO: Fix the code and enable rule
    }

    ruleset('rulesets/dry.xml') {
        exclude 'DuplicateStringLiteral' // TODO: analyze usage and verify correct code
        exclude 'DuplicateNumberLiteral'    //TODO: Fix the code and enable rule
    }

    ruleset('rulesets/design.xml') {
        exclude 'AbstractClassWithoutAbstractMethod' // TODO: analyze usage and verify correct code
        exclude 'FinalClassWithProtectedMember'             // TODO: analyze usage and verify correct code
        exclude 'ImplementationAsType'             // TODO: analyze usage and verify correct code
    }

    ruleset('rulesets/exceptions.xml') {
        exclude 'CatchThrowable'   // TODO: analyze usage and verify correct code
        exclude 'CatchException'    //TODO: Fix the code and enable rule
        exclude 'ThrowRuntimeException'    //TODO: Fix the code and enable rule
        exclude 'ThrowException'    //TODO: Fix the code and enable rule
    }

    ruleset('rulesets/unused.xml') {
        exclude 'UnusedPrivateField'    //TODO: Fix the code and enable rule
        exclude 'UnusedPrivateMethodParameter'   //TODO: Fix the code and enable rule
        exclude 'UnusedPrivateMethod'   //TODO: Fix the code and enable rule
        exclude 'UnusedVariable'        //TODO: Fix the code and enable rule
    }

}