Add checkstyle with a small config
It doesn't include all of the Android style checks as found in Android Studio, but it's a start. Bump Gradle to 2.7 because the checkstyle plugin in earlier versions is just not good enough.
This commit is contained in:
parent
bc283304df
commit
999fa6eb21
@ -19,9 +19,9 @@ before_script:
|
|||||||
- echo " == Installing Android emulator images"
|
- echo " == Installing Android emulator images"
|
||||||
- echo y | android -s update sdk --no-ui -a -t android-10
|
- echo y | android -s update sdk --no-ui -a -t android-10
|
||||||
- echo " == Installing Gradle"
|
- echo " == Installing Gradle"
|
||||||
- wget -q -O gradle.zip https://services.gradle.org/distributions/gradle-2.4-bin.zip
|
- wget -q -O gradle.zip https://services.gradle.org/distributions/gradle-2.7-bin.zip
|
||||||
- unzip -q gradle.zip
|
- unzip -q gradle.zip
|
||||||
- export PATH="$PWD/gradle-2.4/bin:$PATH"
|
- export PATH="$PWD/gradle-2.7/bin:$PATH"
|
||||||
|
|
||||||
test:
|
test:
|
||||||
script:
|
script:
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'witness'
|
apply plugin: 'witness'
|
||||||
|
apply plugin: 'checkstyle'
|
||||||
if (!hasProperty('sourceDeps')) {
|
if (!hasProperty('sourceDeps')) {
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@ -182,6 +183,14 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
task checkstyle(type: Checkstyle) {
|
||||||
|
configFile file("${project.rootDir}/config/checkstyle/checkstyle.xml")
|
||||||
|
source 'src'
|
||||||
|
include '**/*.java'
|
||||||
|
exclude '**/gen/**'
|
||||||
|
|
||||||
|
classpath = files()
|
||||||
|
}
|
||||||
// This person took the example code below from another blogpost online, however
|
// This person took the example code below from another blogpost online, however
|
||||||
// I lost the reference to it:
|
// I lost the reference to it:
|
||||||
// http://stackoverflow.com/questions/23297562/gradle-javadoc-and-android-documentation
|
// http://stackoverflow.com/questions/23297562/gradle-javadoc-and-android-documentation
|
||||||
|
@ -7,3 +7,7 @@ buildscript {
|
|||||||
classpath files('libs/gradle-witness.jar')
|
classpath files('libs/gradle-witness.jar')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task wrapper(type: Wrapper) {
|
||||||
|
gradleVersion = '2.7'
|
||||||
|
}
|
||||||
|
80
config/checkstyle/checkstyle.xml
Normal file
80
config/checkstyle/checkstyle.xml
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!DOCTYPE module PUBLIC
|
||||||
|
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
|
||||||
|
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
|
||||||
|
<module name="Checker">
|
||||||
|
|
||||||
|
<module name="FileTabCharacter" />
|
||||||
|
|
||||||
|
<module name="RegexpSingleline">
|
||||||
|
<property name="format" value="\s+$" />
|
||||||
|
<property name="minimum" value="0" />
|
||||||
|
<property name="maximum" value="0" />
|
||||||
|
<property name="message" value="Line has trailing spaces." />
|
||||||
|
<property name="severity" value="info" />
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<module name="TreeWalker">
|
||||||
|
|
||||||
|
<!--<module name="ConstantName" />-->
|
||||||
|
<!--<module name="LocalFinalVariableName" />-->
|
||||||
|
<!--<module name="LocalVariableName" />-->
|
||||||
|
<!--<module name="MemberName" />-->
|
||||||
|
<!--<module name="MethodName" />-->
|
||||||
|
<module name="PackageName" />
|
||||||
|
<!--<module name="ParameterName" />-->
|
||||||
|
<!--<module name="StaticVariableName" />-->
|
||||||
|
<module name="TypeName" />
|
||||||
|
|
||||||
|
<module name="AvoidStarImport" />
|
||||||
|
<!--<module name="IllegalImport" />-->
|
||||||
|
<module name="RedundantImport" />
|
||||||
|
<module name="UnusedImports" />
|
||||||
|
|
||||||
|
<!--<module name="LineLength">-->
|
||||||
|
<!--<module name="MethodLength" />-->
|
||||||
|
<!--<module name="ParameterNumber" />-->
|
||||||
|
|
||||||
|
<module name="EmptyForIteratorPad" />
|
||||||
|
<module name="GenericWhitespace" />
|
||||||
|
<module name="MethodParamPad" />
|
||||||
|
<!--<module name="NoWhitespaceAfter" />-->
|
||||||
|
<!--<module name="NoWhitespaceBefore" />-->
|
||||||
|
<!--<module name="OperatorWrap" />-->
|
||||||
|
<module name="ParenPad" />
|
||||||
|
<module name="TypecastParenPad" />
|
||||||
|
<!--<module name="WhitespaceAfter" />-->
|
||||||
|
<!--<module name="WhitespaceAround" />-->
|
||||||
|
|
||||||
|
<!--<module name="ModifierOrder" />-->
|
||||||
|
<module name="RedundantModifier" />
|
||||||
|
|
||||||
|
<!--<module name="AvoidNestedBlocks" />-->
|
||||||
|
<!--<module name="EmptyBlock">
|
||||||
|
<property name="option" value="text" />
|
||||||
|
</module>-->
|
||||||
|
<!--<module name="LeftCurly" />-->
|
||||||
|
<!--<module name="NeedBraces" />-->
|
||||||
|
<!--<module name="RightCurly" />-->
|
||||||
|
|
||||||
|
<module name="EmptyStatement" />
|
||||||
|
<!--<module name="EqualsHashCode" />-->
|
||||||
|
<!--<module name="HiddenField" />-->
|
||||||
|
<module name="IllegalInstantiation" />
|
||||||
|
<!--<module name="InnerAssignment" />-->
|
||||||
|
<!--<module name="MagicNumber" />-->
|
||||||
|
<!--<module name="MissingSwitchDefault" />-->
|
||||||
|
<!--<module name="SimplifyBooleanExpression" />-->
|
||||||
|
<!--<module name="SimplifyBooleanReturn" />-->
|
||||||
|
|
||||||
|
<!--<module name="FinalClass" />-->
|
||||||
|
<!--<module name="HideUtilityClassConstructor" />-->
|
||||||
|
<!--<module name="InterfaceIsType" />-->
|
||||||
|
<!--<module name="VisibilityModifier" />-->
|
||||||
|
|
||||||
|
<module name="ArrayTypeStyle" />
|
||||||
|
<module name="UpperEll" />
|
||||||
|
|
||||||
|
</module>
|
||||||
|
|
||||||
|
</module>
|
Loading…
x
Reference in New Issue
Block a user