diff --git a/library/lorcana-data/src/commonMain/kotlin/eu/codlab/lorcana/Card.kt b/library/lorcana-data/src/commonMain/kotlin/eu/codlab/lorcana/Card.kt index c946513..f2f4df0 100644 --- a/library/lorcana-data/src/commonMain/kotlin/eu/codlab/lorcana/Card.kt +++ b/library/lorcana-data/src/commonMain/kotlin/eu/codlab/lorcana/Card.kt @@ -6,7 +6,6 @@ import eu.codlab.lorcana.cards.CardTranslation import eu.codlab.lorcana.franchises.Franchise import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.serialization.json.Json @Serializable data class GenericCard( diff --git a/library/lorcana-data/src/commonMain/kotlin/eu/codlab/lorcana/CompiledSet.kt b/library/lorcana-data/src/commonMain/kotlin/eu/codlab/lorcana/CompiledSet.kt index 73bf149..f2092ba 100644 --- a/library/lorcana-data/src/commonMain/kotlin/eu/codlab/lorcana/CompiledSet.kt +++ b/library/lorcana-data/src/commonMain/kotlin/eu/codlab/lorcana/CompiledSet.kt @@ -26,12 +26,12 @@ class CompiledSet( setCode = card.setCode, franchiseId = franchises[card.franchiseId]!!, dummy = card.dummy, - thirdParty = card.thirdParty, + thirdParty = card.thirdParty ) } suspend fun loadFromGithub(tag: String = "main"): List { - val cards = set.loadFromGithub("main") + val cards = set.loadFromGithub(tag) return cards.map { mapCard(it) } } diff --git a/library/lorcana-data/src/commonMain/kotlin/eu/codlab/lorcana/cards/CardThirdParty.kt b/library/lorcana-data/src/commonMain/kotlin/eu/codlab/lorcana/cards/CardThirdParty.kt index 57922b8..38a15b5 100644 --- a/library/lorcana-data/src/commonMain/kotlin/eu/codlab/lorcana/cards/CardThirdParty.kt +++ b/library/lorcana-data/src/commonMain/kotlin/eu/codlab/lorcana/cards/CardThirdParty.kt @@ -3,7 +3,6 @@ package eu.codlab.lorcana.cards import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable - @Serializable data class CardThirdParty( @SerialName("card_market") diff --git a/library/lorcana-data/src/commonMain/kotlin/eu/codlab/lorcana/franchises/Franchise.kt b/library/lorcana-data/src/commonMain/kotlin/eu/codlab/lorcana/franchises/Franchise.kt index 6d96e04..015b550 100644 --- a/library/lorcana-data/src/commonMain/kotlin/eu/codlab/lorcana/franchises/Franchise.kt +++ b/library/lorcana-data/src/commonMain/kotlin/eu/codlab/lorcana/franchises/Franchise.kt @@ -5,5 +5,5 @@ import kotlinx.serialization.Serializable @Serializable data class Franchise( - val translations: TranslationHolder, + val translations: TranslationHolder ) diff --git a/library/lorcana-data/src/commonMain/kotlin/eu/codlab/lorcana/utils/GithubDefinitions.kt b/library/lorcana-data/src/commonMain/kotlin/eu/codlab/lorcana/utils/GithubDefinitions.kt index 60d2450..953cc08 100644 --- a/library/lorcana-data/src/commonMain/kotlin/eu/codlab/lorcana/utils/GithubDefinitions.kt +++ b/library/lorcana-data/src/commonMain/kotlin/eu/codlab/lorcana/utils/GithubDefinitions.kt @@ -2,6 +2,7 @@ package eu.codlab.lorcana.utils import io.ktor.client.request.get import io.ktor.client.statement.bodyAsText +import io.ktor.http.isSuccess import korlibs.io.lang.FileNotFoundException internal object GithubDefinitions { @@ -9,7 +10,7 @@ internal object GithubDefinitions { val url = "https://raw.githubusercontent.com/codlab/lorcana-data/$version/data/$file.json" val request = Provider.client.get(url) - if (request.status.value !in 200..299) { + if (request.status.isSuccess()) { throw FileNotFoundException("Impossible to find the file $file for version $version") } diff --git a/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingAbilities.kt b/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingAbilities.kt index a98a579..8b65e13 100644 --- a/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingAbilities.kt +++ b/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingAbilities.kt @@ -27,4 +27,4 @@ class TestLoadingAbilities { assertNotNull(content) assertTrue(content.isNotEmpty()) } -} \ No newline at end of file +} diff --git a/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingCards.kt b/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingCards.kt index f0738e4..356f706 100644 --- a/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingCards.kt +++ b/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingCards.kt @@ -20,7 +20,8 @@ class TestLoadingCards { } listOf( - "d23" to 23, "tfc" to 216 + "d23" to 23, + "tfc" to 216 ).forEach { set -> val (name, count) = set val file = VirtualFile(VirtualFile.Root, "../../data/$name.json") @@ -49,4 +50,4 @@ class TestLoadingCards { assertEquals(count, cards.size) } } -} \ No newline at end of file +} diff --git a/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingCompiledSet.kt b/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingCompiledSet.kt index 01b4fb9..875ddf2 100644 --- a/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingCompiledSet.kt +++ b/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingCompiledSet.kt @@ -31,7 +31,7 @@ class TestLoadingCompiledSet { assertNotNull(content) assertTrue(content.isNotEmpty()) assertEquals(originalContent.size, content.size) - } catch (err: Throwable) { + } catch (@Suppress("SwallowedException") err: Throwable) { println("$currentPlatform") throw NullPointerException("$currentPlatform") } @@ -68,4 +68,4 @@ class TestLoadingCompiledSet { assertEquals(count, cards.size) } } -} \ No newline at end of file +} diff --git a/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingFranchises.kt b/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingFranchises.kt index 077bf9a..76154c9 100644 --- a/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingFranchises.kt +++ b/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingFranchises.kt @@ -27,4 +27,4 @@ class TestLoadingFranchises { assertNotNull(content) assertTrue(content.isNotEmpty()) } -} \ No newline at end of file +} diff --git a/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingSet.kt b/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingSet.kt index f7b7ed3..d5bc570 100644 --- a/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingSet.kt +++ b/library/lorcana-data/src/commonTest/kotlin/eu/codlab/lorcana/TestLoadingSet.kt @@ -23,7 +23,7 @@ class TestLoadingSet { assertNotNull(content) assertTrue(content.isNotEmpty()) - } catch (err: Throwable) { + } catch (@Suppress("SwallowedException") err: Throwable) { println("$currentPlatform") throw NullPointerException("$currentPlatform") } @@ -60,4 +60,4 @@ class TestLoadingSet { assertEquals(count, cards.size) } } -} \ No newline at end of file +} diff --git a/library/lorcana-data/src/jvmMain/kotlin/eu/codlab/lorcana/SetLegacy.kt b/library/lorcana-data/src/jvmMain/kotlin/eu/codlab/lorcana/SetLegacy.kt index 4202317..d893acb 100644 --- a/library/lorcana-data/src/jvmMain/kotlin/eu/codlab/lorcana/SetLegacy.kt +++ b/library/lorcana-data/src/jvmMain/kotlin/eu/codlab/lorcana/SetLegacy.kt @@ -16,7 +16,7 @@ enum class SetLegacy(private val set: Set) { GlobalScope.launch { try { resolve(set.loadFromGithub(tag)) - } catch (err: Throwable) { + } catch (@Suppress("TooGenericExceptionCaught") err: Throwable) { reject(err) } } @@ -29,10 +29,10 @@ enum class SetLegacy(private val set: Set) { GlobalScope.launch { try { resolve(set.loadFromResource()) - } catch (err: Throwable) { + } catch (@Suppress("TooGenericExceptionCaught") err: Throwable) { reject(err) } } } } -} \ No newline at end of file +} diff --git a/scripts/publish.sh b/scripts/publish.sh index abe5279..1e4f481 100644 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -1,4 +1,8 @@ #!/bin/bash +# running validation +./gradlew ktlint detekt || (echo "invalid ktlint/detekt output"; exit 1) +./gradlew check || (echo "tests failed"; exit 1) + # simple implementation of delivering locally & then publicly ./gradlew publishToMavenLocal && ./gradlew publishAllPublicationsToSonatypeRepository closeAndReleaseStagingRepository