Added detekt extension

This commit is contained in:
Erik C. Thauvin 2023-11-25 21:46:55 -08:00
parent b4194b765a
commit ac5cb0ef07
5 changed files with 44 additions and 1 deletions

View file

@ -64,8 +64,12 @@ public class AkismetBuild extends Project {
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL);
var okHttp = version(4, 12, 0);
final var kotlin = version(1, 9, 21);
scope(compile)
.include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", version(1, 9, 21)))
.include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlin))
.include(dependency("org.jetbrains.kotlin", "kotlin-stdlib-common", kotlin))
.include(dependency("org.jetbrains.kotlin", "kotlin-stdlib-jdk7", kotlin))
.include(dependency("org.jetbrains.kotlin", "kotlin-stdlib-jdk8", kotlin))
.include(dependency("com.squareup.okhttp3", "okhttp", okHttp))
.include(dependency("com.squareup.okhttp3", "logging-interceptor", okHttp))
.include(dependency("jakarta.servlet", "jakarta.servlet-api", version(6, 0, 0)))
@ -127,6 +131,23 @@ public class AkismetBuild extends Project {
.execute();
}
@BuildCommand(summary = "Checks source with Detekt")
public void detekt() throws ExitStatusException, IOException, InterruptedException {
new DetektOperation()
.fromProject(this)
.baseline("config/detekt/baseline.xml")
.execute();
}
@BuildCommand(value = "detekt-baseline", summary = "Creates the Detekt baseline")
public void detektBaseline() throws ExitStatusException, IOException, InterruptedException {
new DetektOperation()
.fromProject(this)
.baseline("config/detekt/baseline.xml")
.createBaseline(true)
.execute();
}
@BuildCommand(summary = "Generates documentation in HTML format")
public void docs() throws ExitStatusException, IOException, InterruptedException {
var kotlin = new File(srcMainDirectory(), "kotlin").getAbsolutePath();