Added detekt extension
This commit is contained in:
parent
1e016de5fb
commit
cd4d86969f
11 changed files with 65 additions and 17 deletions
2
.idea/kotlinc.xml
generated
2
.idea/kotlinc.xml
generated
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="KotlinJpsPluginSettings">
|
||||
<option name="version" value="1.9.10" />
|
||||
<option name="version" value="1.9.21" />
|
||||
</component>
|
||||
</project>
|
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
|
@ -3,6 +3,8 @@
|
|||
<component name="EntryPointsManager">
|
||||
<pattern value="net.thauvin.erik.crypto.CryptoPriceBuild" />
|
||||
<pattern value="net.thauvin.erik.crypto.CryptoPriceBuild" method="jacoco" />
|
||||
<pattern value="net.thauvin.erik.crypto.CryptoPriceBuild" method="detekt" />
|
||||
<pattern value="net.thauvin.erik.crypto.CryptoPriceBuild" method="detektBaseline" />
|
||||
</component>
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="PDMPlugin">
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<SmellBaseline>
|
||||
<ManuallySuppressedIssues/>
|
||||
<CurrentIssues>
|
||||
<ID>ThrowsCount:CryptoPrice.kt$CryptoPrice.Companion$ @JvmStatic @JvmOverloads @Throws(CryptoException::class, IOException::class) fun apiCall(paths: List<String>, params: Map<String, String> = emptyMap()): String</ID>
|
||||
<ID>ThrowsCount:CryptoPrice.kt$CryptoPrice.Companion$@JvmStatic @Throws(CryptoException::class) fun String.toPrice(): CryptoPrice</ID>
|
||||
</CurrentIssues>
|
||||
</SmellBaseline>
|
2
examples/gradle/.idea/.name
generated
2
examples/gradle/.idea/.name
generated
|
@ -1 +1 @@
|
|||
cryptoprice-examples-gradle
|
||||
cryptoprice-examples-gradle
|
2
examples/gradle/.idea/kotlinc.xml
generated
2
examples/gradle/.idea/kotlinc.xml
generated
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="KotlinJpsPluginSettings">
|
||||
<option name="version" value="1.9.20" />
|
||||
<option name="version" value="1.9.21" />
|
||||
</component>
|
||||
</project>
|
10
examples/gradle/.idea/misc.xml
generated
10
examples/gradle/.idea/misc.xml
generated
|
@ -2,6 +2,16 @@
|
|||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="PDMPlugin">
|
||||
<option name="customRuleSets">
|
||||
<list>
|
||||
<option value="K:\java\semver\config\pmd.xml" />
|
||||
<option value="$PROJECT_DIR$/../../../../java/bld-pitest/config/pmd.xml" />
|
||||
<option value="$PROJECT_DIR$/../../../../java/bld-jacoco-report/config/pmd.xml" />
|
||||
<option value="$PROJECT_DIR$/../../../../java/bld-checkstyle/config/pmd.xml" />
|
||||
<option value="$PROJECT_DIR$/../../../../java/bld-exec/config/pmd.xml" />
|
||||
<option value="$PROJECT_DIR$/../../../../java/bld-testng/config/pmd.xml" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="skipTestSources" value="false" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="20" project-jdk-type="JavaSDK" />
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
## Kotlin Example
|
||||
To compile & run the Kotlin example:
|
||||
To run the Kotlin example:
|
||||
|
||||
```console
|
||||
./gradlew run
|
||||
|
@ -9,7 +9,7 @@ To compile & run the Kotlin example:
|
|||
|
||||
## Java Example
|
||||
|
||||
To compile & run the Java example:
|
||||
To run the Java example:
|
||||
|
||||
```console
|
||||
./gradlew runJava
|
||||
|
|
|
@ -2,6 +2,7 @@ bld.downloadExtensionJavadoc=false
|
|||
bld.downloadExtensionSources=true
|
||||
bld.extension.jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.1
|
||||
bld.extensions=com.uwyn.rife2:bld-kotlin:0.9.0-SNAPSHOT
|
||||
bld.extension-detekt=com.uwyn.rife2:bld-detekt:0.9.0-SNAPSHOT
|
||||
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
||||
bld.downloadLocation=
|
||||
bld.sourceDirectories=
|
||||
|
|
18
pom.xml
18
pom.xml
|
@ -21,6 +21,24 @@
|
|||
<version>1.9.21</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib-common</artifactId>
|
||||
<version>1.9.21</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib-jdk7</artifactId>
|
||||
<version>1.9.21</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
||||
<version>1.9.21</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
|
|
|
@ -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