Added detekt extension
This commit is contained in:
parent
1e016de5fb
commit
cd4d86969f
11 changed files with 65 additions and 17 deletions
|
@ -3,6 +3,7 @@ package net.thauvin.erik.crypto;
|
|||
import rife.bld.BuildCommand;
|
||||
import rife.bld.Project;
|
||||
import rife.bld.extension.CompileKotlinOperation;
|
||||
import rife.bld.extension.DetektOperation;
|
||||
import rife.bld.extension.JacocoReportOperation;
|
||||
import rife.bld.extension.dokka.DokkaOperation;
|
||||
import rife.bld.extension.dokka.LoggingLevel;
|
||||
|
@ -35,8 +36,12 @@ public class CryptoPriceBuild extends Project {
|
|||
autoDownloadPurge = true;
|
||||
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL);
|
||||
|
||||
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("org.json", "json", "20231013"))
|
||||
.include(dependency("com.squareup.okhttp3", "okhttp", version(4, 12, 0)));
|
||||
scope(test)
|
||||
|
@ -91,6 +96,22 @@ public class CryptoPriceBuild extends Project {
|
|||
.execute();
|
||||
}
|
||||
|
||||
@BuildCommand(summary = "Checks source with Detekt")
|
||||
public void detekt() throws ExitStatusException, IOException, InterruptedException {
|
||||
new DetektOperation()
|
||||
.fromProject(this)
|
||||
.execute();
|
||||
}
|
||||
|
||||
@BuildCommand(value = "detekt-baseline", summary = "Creates the Detekt baseline")
|
||||
public void detektBaseline() throws ExitStatusException, IOException, InterruptedException {
|
||||
new DetektOperation()
|
||||
.fromProject(this)
|
||||
.baseline("detekt-baseline.xml")
|
||||
.createBaseline(true)
|
||||
.execute();
|
||||
}
|
||||
|
||||
@BuildCommand(summary = "Generates JaCoCo Reports")
|
||||
public void jacoco() throws IOException {
|
||||
new JacocoReportOperation()
|
||||
|
|
|
@ -113,12 +113,16 @@ open class CryptoPrice(val base: String, val currency: String, val amount: BigDe
|
|||
if (json.has("errors")) {
|
||||
val data = json.getJSONArray("errors")
|
||||
throw CryptoException(
|
||||
response.code, data.getJSONObject(0).getString("id"),
|
||||
response.code,
|
||||
data.getJSONObject(0).getString("id"),
|
||||
data.getJSONObject(0).getString("message")
|
||||
)
|
||||
} else {
|
||||
throw CryptoException(response.code, json.getString("error"),
|
||||
json.getString("message"))
|
||||
throw CryptoException(
|
||||
response.code,
|
||||
json.getString("error"),
|
||||
json.getString("message")
|
||||
)
|
||||
}
|
||||
}
|
||||
} catch (e: JSONException) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue