build: switch to spotless (#355)

* build: switch to spotless

add in some other basic formatting steps that allow for easy
auto-correction

* build: lint text files as well

* chore: remove license headers from package-info files

spotless can't verify these
This commit is contained in:
zml 2022-05-23 23:23:09 -07:00 committed by Jason
parent cc7793925d
commit ed7b7569a8
77 changed files with 81 additions and 1545 deletions

View file

@ -5,7 +5,7 @@ import org.cadixdev.gradle.licenser.header.HeaderStyle
plugins {
id("net.kyori.indra")
id("net.kyori.indra.checkstyle")
id("net.kyori.indra.license-header")
id("com.diffplug.spotless")
id("net.ltgt.errorprone")
}
@ -40,10 +40,27 @@ tasks {
}
}
license {
header(rootProject.file("HEADER"))
style["java"] = HeaderStyle.DOUBLE_SLASH.format
style["kt"] = HeaderStyle.DOUBLE_SLASH.format
spotless {
java {
licenseHeaderFile(rootProject.file("HEADER"))
importOrderFile(rootProject.file(".spotless/cloud.importorder"))
indentWithSpaces(4)
trimTrailingWhitespace()
endWithNewline()
}
kotlin {
licenseHeaderFile(rootProject.file("HEADER"))
indentWithSpaces(4)
trimTrailingWhitespace()
endWithNewline()
}
format("configs") {
target("**/*.yml", "**/*.yaml", "**/*.json")
targetExclude("run/**")
indentWithSpaces(2)
trimTrailingWhitespace()
endWithNewline()
}
}
repositories {

View file

@ -5,7 +5,6 @@ plugins {
id("cloud.base-conventions")
kotlin("jvm")
id("org.jetbrains.dokka")
id("org.jlleitschuh.gradle.ktlint")
}
kotlin {
@ -40,6 +39,12 @@ tasks {
}
}
spotless {
kotlin {
ktlint()
}
}
kotlin {
explicitApi()
}