Compare commits

...

2 Commits

Author SHA1 Message Date
Sebastian Kürten
9c42af1489 Replace space indent with tabs 2022-08-22 11:45:35 +02:00
Sebastian Kürten
4496df723a Add checkstyle configuration and apply to all modules 2022-08-22 11:37:48 +02:00
10 changed files with 101 additions and 44 deletions

View File

@@ -5,6 +5,7 @@ targetCompatibility = 1.8
apply plugin: 'ru.vyarus.animalsniffer' apply plugin: 'ru.vyarus.animalsniffer'
apply plugin: 'witness' apply plugin: 'witness'
apply from: 'witness.gradle' apply from: 'witness.gradle'
apply plugin: 'checkstyle'
dependencies { dependencies {
implementation "com.google.dagger:dagger:$dagger_version" implementation "com.google.dagger:dagger:$dagger_version"

View File

@@ -7,6 +7,7 @@ apply plugin: 'idea'
apply plugin: 'witness' apply plugin: 'witness'
apply from: 'witness.gradle' apply from: 'witness.gradle'
apply from: '../dagger.gradle' apply from: '../dagger.gradle'
apply plugin: 'checkstyle'
dependencies { dependencies {
implementation project(path: ':bramble-api', configuration: 'default') implementation project(path: ':bramble-api', configuration: 'default')

View File

@@ -6,6 +6,7 @@ apply plugin: 'idea'
apply plugin: 'witness' apply plugin: 'witness'
apply from: 'witness.gradle' apply from: 'witness.gradle'
apply from: '../dagger.gradle' apply from: '../dagger.gradle'
apply plugin: 'checkstyle'
configurations { configurations {
tor tor

View File

@@ -1,6 +1,10 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'witness' apply plugin: 'witness'
apply from: 'witness.gradle' apply from: 'witness.gradle'
apply plugin: 'checkstyle'
// Need to manually apply this as the Java plugin is not applied to this module hence this is not
// done automatically.
apply from: "${rootProject.rootDir}/gradle/checkstyle.gradle"
def getStdout = { command, defaultValue -> def getStdout = { command, defaultValue ->
def stdout = new ByteArrayOutputStream() def stdout = new ByteArrayOutputStream()

View File

@@ -5,6 +5,7 @@ targetCompatibility = 1.8
apply plugin: 'ru.vyarus.animalsniffer' apply plugin: 'ru.vyarus.animalsniffer'
apply plugin: 'witness' apply plugin: 'witness'
apply from: 'witness.gradle' apply from: 'witness.gradle'
apply plugin: 'checkstyle'
dependencies { dependencies {
implementation project(path: ':bramble-api', configuration: 'default') implementation project(path: ':bramble-api', configuration: 'default')

View File

@@ -7,6 +7,7 @@ apply plugin: 'idea'
apply plugin: 'witness' apply plugin: 'witness'
apply from: 'witness.gradle' apply from: 'witness.gradle'
apply from: '../dagger.gradle' apply from: '../dagger.gradle'
apply plugin: 'checkstyle'
dependencies { dependencies {
implementation project(path: ':briar-api', configuration: 'default') implementation project(path: ':briar-api', configuration: 'default')

View File

@@ -0,0 +1,19 @@
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<property name="tabWidth" value="4"/>
<property name="charset" value="UTF-8"/>
<module name="LineLength">
<property name="fileExtensions" value="java"/>
<property name="max" value="1000"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
<module name="TreeWalker">
<module name="RegexpSinglelineJava">
<property name="format" value="^\t* +\t*\S"/>
<property name="message" value="Line has leading space characters; indentation should be performed with tabs only."/>
<property name="ignoreComments" value="true"/>
</module>
</module>
</module>

29
gradle/checkstyle.gradle Normal file
View File

@@ -0,0 +1,29 @@
task checkstyleMain(type: Checkstyle) {
source 'src/main/java'
include '**/*.java'
classpath = files()
reports {
xml {
destination file("build/reports/checkstyle/main.xml")
}
html {
destination file("build/reports/checkstyle/main.html")
}
}
check.dependsOn it
}
task checkstyleTest(type: Checkstyle) {
source 'src/test/java'
include '**/*.java'
classpath = files()
reports {
xml {
destination file("build/reports/checkstyle/test.xml")
}
html {
destination file("build/reports/checkstyle/test.html")
}
}
check.dependsOn it
}