mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-01-09 08:50:34 +00:00
Add Ktlint
This commit is contained in:
parent
f4f4f062cf
commit
f5f8e5d279
@ -116,25 +116,40 @@ task runCheckstyle(type: Checkstyle) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(Checkstyle).each {
|
runCheckstyle.doLast {
|
||||||
checkstyleTask -> checkstyleTask.doLast {
|
reports.all { report ->
|
||||||
reports.all { report ->
|
def outputFile = report.destination
|
||||||
def outputFile = report.destination
|
if (outputFile.exists() && outputFile.text.contains("severity=\"error\"")) {
|
||||||
if (outputFile.exists() && outputFile.text.contains("severity=\"error\"")) {
|
throw new GradleException("There were checkstyle errors! For more info check $outputFile")
|
||||||
throw new GradleException("There were checkstyle errors! For more info check $outputFile")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
ktlint
|
||||||
|
}
|
||||||
|
|
||||||
|
task runKtlint(type: JavaExec) {
|
||||||
|
main = "com.pinterest.ktlint.Main"
|
||||||
|
classpath = configurations.ktlint
|
||||||
|
args "src/**/*.kt"
|
||||||
|
}
|
||||||
|
|
||||||
|
task formatKtlint(type: JavaExec) {
|
||||||
|
main = "com.pinterest.ktlint.Main"
|
||||||
|
classpath = configurations.ktlint
|
||||||
|
args "-F", "src/**/*.kt"
|
||||||
|
}
|
||||||
|
|
||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
preDebugBuild.dependsOn runCheckstyle
|
preDebugBuild.dependsOn runCheckstyle, runKtlint
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||||
|
|
||||||
debugImplementation "com.puppycrawl.tools:checkstyle:${checkstyleVersion}"
|
debugImplementation "com.puppycrawl.tools:checkstyle:${checkstyleVersion}"
|
||||||
|
ktlint "com.pinterest:ktlint:0.35.0"
|
||||||
|
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||||
androidTestImplementation "android.arch.persistence.room:testing:1.1.1"
|
androidTestImplementation "android.arch.persistence.room:testing:1.1.1"
|
||||||
|
Loading…
Reference in New Issue
Block a user