Move ktlint config to project-level

This commit is contained in:
Mikołaj Pich 2019-11-17 17:14:24 +01:00
parent ff7c3c934c
commit b7e2d76f14
No known key found for this signature in database
GPG key ID: F62B26E36D4C4BAA
8 changed files with 21 additions and 36 deletions

View file

@ -1,5 +1,7 @@
plugins {
id 'jacoco'
id 'org.jetbrains.kotlin.jvm' version '1.3.50' apply false
id "org.jlleitschuh.gradle.ktlint" version "9.1.1"
}
subprojects {
@ -22,6 +24,16 @@ ext {
allprojects {
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: "org.jlleitschuh.gradle.ktlint"
ktlint {
additionalEditorconfigFile = file(".editorconfig")
disabledRules = [
"no-wildcard-imports",
"import-ordering",
"max-line-length"
]
}
sourceCompatibility = 1.8
@ -51,6 +63,12 @@ allprojects {
testImplementation "junit:junit:4.12"
}
jacocoTestReport {
reports {
xml.enabled true
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource

View file

@ -2,7 +2,7 @@ package io.github.wulkanowy.sdk.mobile
import com.google.gson.annotations.SerializedName
import java.time.Instant.now
import java.util.*
import java.util.UUID
@Suppress("unused")
abstract class ApiRequest(

View file

@ -1,6 +1,5 @@
package io.github.wulkanowy.sdk.mobile
import java.util.LinkedList
import kotlin.reflect.KProperty

View file

@ -1,7 +1,6 @@
package io.github.wulkanowy.sdk.mobile.attendance
import com.google.gson.annotations.SerializedName
import io.github.wulkanowy.sdk.mobile.attendance.Attendance
data class AttendanceResponse(

View file

@ -2,7 +2,7 @@ package io.github.wulkanowy.sdk.mobile.register
import com.google.gson.annotations.SerializedName
import io.github.wulkanowy.sdk.mobile.ApiRequest
import java.util.*
import java.util.UUID
data class CertificateRequest(

View file

@ -1,7 +1,6 @@
package io.github.wulkanowy.sdk.mobile.school
import com.google.gson.annotations.SerializedName
import io.github.wulkanowy.sdk.mobile.school.Teacher
data class TeachersResponse(

View file

@ -6,10 +6,6 @@ plugins {
// id 'com.jfrog.bintray' version '1.8.4'
}
configurations {
ktlint
}
dependencies {
implementation "pl.droidsonroids:jspoon:$jspoon"
implementation "pl.droidsonroids.retrofit2:converter-jspoon:$jspoon"
@ -25,32 +21,6 @@ dependencies {
implementation "org.slf4j:slf4j-api:$slf4j"
testImplementation "org.slf4j:slf4j-simple:$slf4j"
ktlint "com.pinterest:ktlint:0.35.0"
}
task ktlint(type: JavaExec, group: "verification") {
description = "Check Kotlin code style."
classpath = configurations.ktlint
main = "com.pinterest.ktlint.Main"
args "src/**/*.kt"
// to generate report in checkstyle format prepend following args:
// "--reporter=plain", "--reporter=checkstyle,output=${buildDir}/ktlint.xml"
// see https://github.com/pinterest/ktlint#usage for more
}
check.dependsOn ktlint
task ktlintFormat(type: JavaExec, group: "formatting") {
description = "Fix Kotlin code style deviations."
classpath = configurations.ktlint
main = "com.pinterest.ktlint.Main"
args "-F", "src/**/*.kt"
}
jacocoTestReport {
reports {
xml.enabled true
}
}
//bintray {

View file

@ -13,4 +13,4 @@ data class Semester(
val end: LocalDate,
val classId: Int,
val unitId: Int
)
)