Skip to content

Commit 185d76d

Browse files
committed
Add CodeNarc checks
1 parent 21db429 commit 185d76d

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ buildscript {
1414
apply plugin: 'groovy'
1515
apply plugin: 'java-gradle-plugin'
1616
apply plugin: 'maven'
17+
apply plugin: 'codenarc'
1718

1819
apply plugin: "com.gradle.plugin-publish"
1920

config/codenarc/codenarc.xml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!--
2+
~ Copyright 2017 the original author or authors.
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
<ruleset xmlns="http://codenarc.org/ruleset/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
17+
xsi:schemaLocation="http://codenarc.org/ruleset/1.0 http://codenarc.org/ruleset-schema.xsd"
18+
xsi:noNamespaceSchemaLocation="http://codenarc.org/ruleset-schema.xsd">
19+
<ruleset-ref path='rulesets/braces.xml'/>
20+
<ruleset-ref path='rulesets/imports.xml'>
21+
<exclude name="ImportFromSunPackages"/>
22+
<exclude name="MisorderedStaticImports"/>
23+
<exclude name="NoWildcardImports"/>
24+
</ruleset-ref>
25+
<ruleset-ref path='rulesets/naming.xml'>
26+
<rule-config name='ClassName'>
27+
<property name='regex' value='^[A-Z][\$a-zA-Z0-9_]*$'/>
28+
</rule-config>
29+
<rule-config name='FieldName'>
30+
<property name='finalRegex' value='^[a-z][a-zA-Z0-9]*$'/>
31+
<property name='staticFinalRegex' value='^logger$|^[A-Z][A-Z_0-9]*$|^serialVersionUID$'/>
32+
</rule-config>
33+
<rule-config name='MethodName'>
34+
<property name='regex' value='^[a-z][\$_a-zA-Z0-9]*$|^.*\s.*$'/>
35+
</rule-config>
36+
<rule-config name='VariableName'>
37+
<property name='finalRegex' value='^[a-z][a-zA-Z0-9]*$'/>
38+
</rule-config>
39+
<exclude name="ConfusingMethodName"/>
40+
<exclude name="FactoryMethodName"/>
41+
<exclude name="ClassNameSameAsSuperclass"/>
42+
</ruleset-ref>
43+
</ruleset>

src/main/groovy/org/gradle/android/AndroidCacheFixPlugin.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class AndroidCacheFixPlugin implements Plugin<Project> {
2626

2727
private static final String IGNORE_VERSION_CHECK_PROPERTY = "org.gradle.android.cache-fix.ignoreVersionCheck"
2828

29-
private static List<Workaround> WORKAROUNDS = [
29+
private static final List<Workaround> WORKAROUNDS = [
3030
new AndroidJavaCompile_BootClasspath_Workaround(),
3131
new AndroidJavaCompile_AnnotationProcessorSource_Workaround(),
3232
new AndroidJavaCompile_ProcessorListFile_Workaround(),

0 commit comments

Comments
 (0)