Skip to content

Commit 117bc79

Browse files
committed
Merge pull request #83 from orhanobut/refactoring
checkstyle and refactoring
2 parents 4e053c7 + ba0d7da commit 117bc79

35 files changed

+264
-284
lines changed

build.gradle

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,15 @@ buildscript {
66
}
77
dependencies {
88
classpath 'com.android.tools.build:gradle:1.2.3'
9+
classpath 'com.github.dcendents:android-maven-plugin:1.2'
910

1011
// NOTE: Do not place your application dependencies here; they belong
1112
// in the individual module build.gradle files
1213

1314
}
1415
}
1516

16-
17-
def isReleaseBuild() {
18-
return version.contains("SNAPSHOT") == false
19-
}
20-
2117
allprojects {
22-
version = VERSION_NAME
23-
group = GROUP
24-
2518
repositories {
2619
jcenter()
2720
}

checkstyle.xml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE module PUBLIC
3+
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
4+
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
5+
6+
<module name="Checker">
7+
<!--module name="NewlineAtEndOfFile"/-->
8+
<module name="FileLength"/>
9+
<module name="FileTabCharacter"/>
10+
11+
<!-- Trailing spaces -->
12+
<module name="RegexpSingleline">
13+
<property name="format" value="\s+$"/>
14+
<property name="message" value="Line has trailing spaces."/>
15+
</module>
16+
17+
<!-- Space after 'for' and 'if' -->
18+
<module name="RegexpSingleline">
19+
<property name="format" value="^\s*(for|if)[^ ]"/>
20+
<property name="message" value="Space needed before opening parenthesis."/>
21+
</module>
22+
23+
<!-- For each spacing -->
24+
<module name="RegexpSingleline">
25+
<property name="format" value="^\s*for \(.*?([^ ]:|:[^ ])"/>
26+
<property name="message" value="Space needed around ':' character."/>
27+
</module>
28+
29+
<module name="TreeWalker">
30+
<!-- <property name="cacheFile" value="${checkstyle.cache.file}"/> -->
31+
32+
33+
<!-- Checks for Javadoc comments. -->
34+
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
35+
<!--module name="JavadocMethod"/-->
36+
<!--module name="JavadocType"/-->
37+
<!--module name="JavadocVariable"/-->
38+
<!--module name="JavadocStyle"/-->
39+
40+
41+
<!-- Checks for Naming Conventions. -->
42+
<!-- See http://checkstyle.sf.net/config_naming.html -->
43+
<module name="ConstantName"/>
44+
<module name="LocalFinalVariableName"/>
45+
<module name="LocalVariableName"/>
46+
<module name="MemberName"/>
47+
<module name="MethodName">
48+
<property name="format" value="^[a-z][a-zA-Z0-9_]*$"/>
49+
</module>
50+
<module name="PackageName"/>
51+
<module name="ParameterName"/>
52+
<module name="StaticVariableName"/>
53+
<module name="TypeName">
54+
<property name="format" value="^[A-Z][a-zA-Z0-9_]*$"/>
55+
</module>
56+
57+
58+
<!-- Checks for imports -->
59+
<!-- See http://checkstyle.sf.net/config_import.html -->
60+
<module name="AvoidStarImport"/>
61+
<module name="IllegalImport"/>
62+
<module name="RedundantImport"/>
63+
<module name="UnusedImports">
64+
<property name="processJavadoc" value="true"/>
65+
</module>
66+
67+
68+
<!-- Checks for Size Violations. -->
69+
<!-- See http://checkstyle.sf.net/config_sizes.html -->
70+
<module name="LineLength">
71+
<property name="max" value="120"/>
72+
</module>
73+
<!--<module name="MethodLength"/>-->
74+
<module name="ParameterNumber"/>
75+
76+
77+
<!-- Checks for whitespace -->
78+
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
79+
<module name="GenericWhitespace"/>
80+
<module name="EmptyForIteratorPad"/>
81+
<module name="MethodParamPad"/>
82+
83+
<module name="NoWhitespaceAfter">
84+
<property name="tokens" value="DOT"/>
85+
<property name="allowLineBreaks" value="false"/>
86+
</module>
87+
88+
<module name="WhitespaceAfter">
89+
<property name="tokens" value="COMMA, SEMI"/>
90+
</module>
91+
92+
<!--<module name="OperatorWrap"/>-->
93+
<module name="ParenPad"/>
94+
<module name="TypecastParenPad"/>
95+
<module name="WhitespaceAfter"/>
96+
<module name="WhitespaceAround"/>
97+
98+
99+
<!-- Modifier Checks -->
100+
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
101+
<!--module name="ModifierOrder"/-->
102+
<module name="RedundantModifier"/>
103+
104+
105+
<!-- Checks for blocks. You know, those {}'s -->
106+
<!-- See http://checkstyle.sf.net/config_blocks.html -->
107+
<module name="AvoidNestedBlocks"/>
108+
<module name="EmptyBlock"/>
109+
<module name="LeftCurly"/>
110+
<module name="NeedBraces">
111+
<property name="tokens" value="LITERAL_DO, LITERAL_ELSE, LITERAL_FOR, LITERAL_WHILE"/>
112+
</module>
113+
<module name="RightCurly"/>
114+
115+
116+
<!-- Checks for common coding problems -->
117+
<!-- See http://checkstyle.sf.net/config_coding.html -->
118+
<!--<module name="AvoidInlineConditionals"/>-->
119+
<module name="CovariantEquals"/>
120+
<!--<module name="DoubleCheckedLocking"/>-->
121+
<module name="EmptyStatement"/>
122+
<module name="EqualsAvoidNull"/>
123+
<module name="EqualsHashCode"/>
124+
<!--<module name="HiddenField"/>-->
125+
<module name="IllegalInstantiation"/>
126+
<module name="InnerAssignment"/>
127+
<!--<module name="MagicNumber"/>-->
128+
<module name="MissingSwitchDefault"/>
129+
<!--<module name="RedundantThrows"/>-->
130+
<module name="SimplifyBooleanExpression"/>
131+
<module name="SimplifyBooleanReturn"/>
132+
133+
<!-- Checks for class design -->
134+
<!-- See http://checkstyle.sf.net/config_design.html -->
135+
<!--module name="DesignForExtension"/-->
136+
<!--module name="FinalClass"/-->
137+
<module name="HideUtilityClassConstructor"/>
138+
<module name="InterfaceIsType"/>
139+
<!--<module name="VisibilityModifier"/>-->
140+
141+
142+
<!-- Miscellaneous other checks. -->
143+
<!-- See http://checkstyle.sf.net/config_misc.html -->
144+
<module name="ArrayTypeStyle"/>
145+
<!--module name="FinalParameters"/-->
146+
<module name="TodoComment"/>
147+
<module name="UpperEll"/>
148+
</module>
149+
</module>

gradle.properties

Lines changed: 0 additions & 34 deletions
This file was deleted.

hawk/build.gradle

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
apply plugin: 'com.android.library'
2+
apply plugin: 'com.github.dcendents.android-maven'
3+
4+
apply plugin: 'checkstyle'
5+
6+
check.dependsOn('checkstyle')
7+
8+
task checkstyle(type: Checkstyle) {
9+
configFile = rootProject.file('checkstyle.xml')
10+
source 'src'
11+
include '**/*.java'
12+
exclude '**/gen/**'
13+
14+
classpath = files()
15+
}
216

317
android {
418
compileSdkVersion 21
519
buildToolsVersion "21.1.2"
620

721
defaultConfig {
8-
minSdkVersion 8
22+
minSdkVersion 9
923
targetSdkVersion 21
1024
}
1125

@@ -14,19 +28,35 @@ android {
1428
}
1529
}
1630

31+
// build a jar with source files
32+
task sourcesJar(type: Jar) {
33+
from android.sourceSets.main.java.srcDirs
34+
classifier = 'sources'
35+
}
36+
37+
task javadoc(type: Javadoc) {
38+
failOnError false
39+
source = android.sourceSets.main.java.sourceFiles
40+
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
41+
}
42+
43+
// build a jar with javadoc
44+
task javadocJar(type: Jar, dependsOn: javadoc) {
45+
classifier = 'javadoc'
46+
from javadoc.destinationDir
47+
}
48+
1749
configurations {
1850
optional
1951
compile.extendsFrom optional
2052
}
2153

2254
dependencies {
2355
compile 'com.google.code.gson:gson:2.3.1'
24-
optional 'io.reactivex:rxandroid:0.25.0'
56+
optional 'io.reactivex:rxandroid:1.0.1'
2557

2658
testCompile 'junit:junit:4.12'
2759
testCompile "org.mockito:mockito-core:1.9.5"
2860
testCompile "org.robolectric:robolectric:3.0"
2961
testCompile 'org.assertj:assertj-core:1.7.0'
30-
}
31-
32-
apply from: '../maven_push.gradle'
62+
}

hawk/src/main/AndroidManifest.xml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
<manifest
2-
package="com.orhanobut.hawk"
3-
xmlns:android="http://schemas.android.com/apk/res/android">
4-
5-
<application android:allowBackup="true">
6-
7-
</application>
8-
1+
<manifest package="com.orhanobut.hawk">
2+
<application/>
93
</manifest>

0 commit comments

Comments
 (0)