Added checkstyle

This commit is contained in:
ByteHamster 2019-09-24 11:12:35 +02:00
parent c16fe7a7c9
commit b7301ca360
3 changed files with 55 additions and 0 deletions

View File

@ -51,9 +51,25 @@ jobs:
- ~/android - ~/android
key: v1-android-{{ checksum "build.gradle" }} key: v1-android-{{ checksum "build.gradle" }}
checkstyle:
docker:
- image: circleci/android:api-28
working_directory: ~/AntennaPod
steps:
- checkout
- run:
name: Checkstyle
command: ./gradlew checkstyle
workflows: workflows:
version: 2 version: 2
test: test:
jobs: jobs:
- test - test
checkstyle:
jobs:
- checkstyle

View File

@ -82,3 +82,14 @@ wrapper {
def doFreeBuild() { def doFreeBuild() {
return hasProperty("freeBuild") return hasProperty("freeBuild")
} }
apply plugin: "checkstyle"
checkstyle {
toolVersion '8.24'
}
task checkstyle(type: Checkstyle) {
classpath = files()
source "${project.rootDir}"
exclude("**/gen/**")
}

View File

@ -0,0 +1,28 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name = "Checker">
<property name="charset" value="UTF-8"/>
<property name="severity" value="error"/>
<property name="fileExtensions" value="java, xml"/>
<module name="TreeWalker">
<module name="AvoidEscapedUnicodeCharacters">
<property name="allowEscapesForControlCharacters" value="true"/>
<property name="allowByTailComment" value="true"/>
<property name="allowNonPrintableEscapes" value="true"/>
</module>
<module name="AvoidStarImport"/>
<module name="OneTopLevelClass"/>
<module name="OneStatementPerLine"/>
<module name="ModifierOrder"/>
<module name="PackageName">
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
<message key="name.invalidPattern"
value="Package name ''{0}'' must match pattern ''{1}''."/>
</module>
</module>
</module>