From 7780d36b540814018b468884d03025d464cd5205 Mon Sep 17 00:00:00 2001 From: Joffrey Bion Date: Thu, 20 Aug 2020 15:36:49 +0200 Subject: Upgrade ktlint and re-enable import order check --- build.gradle.kts | 27 +++++++++++----------- sw-bot/build.gradle.kts | 1 - .../org/luxons/sevenwonders/bot/SevenWondersBot.kt | 5 +++- sw-client/build.gradle.kts | 1 - sw-common-model/build.gradle.kts | 3 +-- sw-engine/build.gradle.kts | 1 - .../org/luxons/sevenwonders/engine/GameTest.kt | 12 ++++++---- .../luxons/sevenwonders/engine/boards/TableTest.kt | 2 +- .../luxons/sevenwonders/engine/cards/CardTest.kt | 6 ++--- .../luxons/sevenwonders/engine/cards/HandsTest.kt | 2 +- .../sevenwonders/engine/cards/RequirementsTest.kt | 6 ++--- .../ProductionIncreaseSerializerTest.kt | 2 +- .../data/serializers/ProductionSerializerTest.kt | 2 +- .../data/serializers/ResourcesSerializerTest.kt | 6 ++--- .../engine/effects/BonusPerBoardElementTest.kt | 6 ++--- .../sevenwonders/engine/effects/DiscountTest.kt | 4 ++-- .../engine/effects/GoldIncreaseTest.kt | 2 +- .../engine/effects/MilitaryReinforcementsTest.kt | 2 +- .../engine/effects/ProductionIncreaseTest.kt | 2 +- .../engine/effects/ScienceProgressTest.kt | 2 +- .../engine/effects/SpecialAbilityActivationTest.kt | 4 ++-- .../engine/moves/BuildWonderMoveTest.kt | 2 +- .../engine/resources/BestPriceCalculatorTest.kt | 8 +++---- .../engine/resources/ResourceTransactionsTest.kt | 2 +- .../engine/resources/TradingRulesTest.kt | 4 ++-- .../sevenwonders/engine/wonders/WonderTest.kt | 2 +- sw-server/build.gradle.kts | 1 - .../luxons/sevenwonders/server/SevenWondersTest.kt | 11 +++++++-- sw-ui/build.gradle.kts | 1 - .../sevenwonders/ui/components/GlobalStyles.kt | 3 +-- .../ui/components/game/ProductionBar.kt | 3 +-- .../sevenwonders/ui/components/lobby/Lobby.kt | 20 +++++++++++++--- 32 files changed, 87 insertions(+), 68 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index d1c0fb73..d7972105 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,4 @@ -import org.gradle.api.tasks.testing.logging.TestLogEvent.* +import org.gradle.api.tasks.testing.logging.TestLogEvent plugins { val kotlinVersion = "1.3.72" @@ -6,14 +6,22 @@ plugins { kotlin("jvm") version kotlinVersion apply false kotlin("multiplatform") version kotlinVersion apply false kotlin("plugin.spring") version kotlinVersion apply false - id("org.jetbrains.kotlin.plugin.serialization") version kotlinVersion apply false - id("org.jlleitschuh.gradle.ktlint") version "9.1.1" apply false + kotlin("plugin.serialization") version kotlinVersion apply false + id("org.jlleitschuh.gradle.ktlint") version "9.3.0" } -subprojects { +allprojects { repositories { jcenter() } +} + +subprojects { + apply(plugin = "org.jlleitschuh.gradle.ktlint") + + ktlint { + disabledRules.set(setOf("no-wildcard-imports")) + } val compilerArgs = listOf("-Xopt-in=kotlin.RequiresOptIn") tasks.withType { @@ -27,18 +35,9 @@ subprojects { tasks.withType { testLogging { - events(FAILED, STANDARD_ERROR) + events(TestLogEvent.FAILED, TestLogEvent.STANDARD_ERROR) exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL showStackTraces = true } } - - afterEvaluate { - // The import ordering expected by ktlint is alphabetical, which doesn't match IDEA's formatter. - // Since it is not configurable, we have to disable the rule. - // https://github.com/pinterest/ktlint/issues/527 - extensions.configure { - disabledRules.set(setOf("import-ordering", "no-wildcard-imports")) - } - } } diff --git a/sw-bot/build.gradle.kts b/sw-bot/build.gradle.kts index fd4de5e0..ac565683 100644 --- a/sw-bot/build.gradle.kts +++ b/sw-bot/build.gradle.kts @@ -1,6 +1,5 @@ plugins { kotlin("jvm") - id("org.jlleitschuh.gradle.ktlint") } dependencies { diff --git a/sw-bot/src/main/kotlin/org/luxons/sevenwonders/bot/SevenWondersBot.kt b/sw-bot/src/main/kotlin/org/luxons/sevenwonders/bot/SevenWondersBot.kt index 61ef37e9..c03ee201 100644 --- a/sw-bot/src/main/kotlin/org/luxons/sevenwonders/bot/SevenWondersBot.kt +++ b/sw-bot/src/main/kotlin/org/luxons/sevenwonders/bot/SevenWondersBot.kt @@ -2,7 +2,10 @@ package org.luxons.sevenwonders.bot import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.delay -import kotlinx.coroutines.flow.* +import kotlinx.coroutines.flow.collect +import kotlinx.coroutines.flow.onCompletion +import kotlinx.coroutines.flow.onStart +import kotlinx.coroutines.flow.takeWhile import kotlinx.coroutines.withTimeout import org.luxons.sevenwonders.client.SevenWondersClient import org.luxons.sevenwonders.client.SevenWondersSession diff --git a/sw-client/build.gradle.kts b/sw-client/build.gradle.kts index 8671db0d..8412c25d 100644 --- a/sw-client/build.gradle.kts +++ b/sw-client/build.gradle.kts @@ -1,6 +1,5 @@ plugins { kotlin("multiplatform") - id("org.jlleitschuh.gradle.ktlint") } val krossbowVersion = "0.21.1" diff --git a/sw-common-model/build.gradle.kts b/sw-common-model/build.gradle.kts index ac1ad423..14cae06e 100644 --- a/sw-common-model/build.gradle.kts +++ b/sw-common-model/build.gradle.kts @@ -1,7 +1,6 @@ plugins { kotlin("multiplatform") - id("org.jetbrains.kotlin.plugin.serialization") - id("org.jlleitschuh.gradle.ktlint") + kotlin("plugin.serialization") } val kotlinSerialization = "0.20.0" diff --git a/sw-engine/build.gradle.kts b/sw-engine/build.gradle.kts index 9e6da395..ee3421f1 100644 --- a/sw-engine/build.gradle.kts +++ b/sw-engine/build.gradle.kts @@ -1,6 +1,5 @@ plugins { kotlin("jvm") - id("org.jlleitschuh.gradle.ktlint") } dependencies { diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/GameTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/GameTest.kt index 595ca1e0..9e8e3e52 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/GameTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/GameTest.kt @@ -1,14 +1,18 @@ package org.luxons.sevenwonders.engine -import org.luxons.sevenwonders.model.cards.HandCard -import org.luxons.sevenwonders.model.cards.TableCard import org.luxons.sevenwonders.engine.data.GameDefinition import org.luxons.sevenwonders.engine.data.LAST_AGE import org.luxons.sevenwonders.engine.test.SEED +import org.luxons.sevenwonders.engine.test.testSettings +import org.luxons.sevenwonders.model.Action +import org.luxons.sevenwonders.model.MoveType +import org.luxons.sevenwonders.model.PlayedMove +import org.luxons.sevenwonders.model.PlayerMove +import org.luxons.sevenwonders.model.PlayerTurnInfo +import org.luxons.sevenwonders.model.cards.HandCard +import org.luxons.sevenwonders.model.cards.TableCard import org.luxons.sevenwonders.model.resources.ResourceTransactions import org.luxons.sevenwonders.model.resources.noTransactions -import org.luxons.sevenwonders.engine.test.testSettings -import org.luxons.sevenwonders.model.* import org.luxons.sevenwonders.model.wonders.deal import kotlin.random.Random import kotlin.test.Test diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/boards/TableTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/boards/TableTest.kt index c37b71e1..7c22b069 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/boards/TableTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/boards/TableTest.kt @@ -5,9 +5,9 @@ import org.junit.experimental.theories.DataPoints import org.junit.experimental.theories.Theories import org.junit.experimental.theories.Theory import org.junit.runner.RunWith -import org.luxons.sevenwonders.model.boards.RelativeBoardPosition import org.luxons.sevenwonders.engine.test.createGuildCards import org.luxons.sevenwonders.engine.test.testTable +import org.luxons.sevenwonders.model.boards.RelativeBoardPosition import kotlin.test.assertEquals @RunWith(Theories::class) diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/CardTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/CardTest.kt index 2b0e5462..5f22acb3 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/CardTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/CardTest.kt @@ -2,16 +2,16 @@ package org.luxons.sevenwonders.engine.cards import org.junit.Test import org.luxons.sevenwonders.engine.SimplePlayer -import org.luxons.sevenwonders.model.cards.Color import org.luxons.sevenwonders.engine.boards.Board import org.luxons.sevenwonders.engine.boards.Table import org.luxons.sevenwonders.engine.effects.ProductionIncrease import org.luxons.sevenwonders.engine.resources.Production -import org.luxons.sevenwonders.model.resources.ResourceType -import org.luxons.sevenwonders.model.resources.noTransactions import org.luxons.sevenwonders.engine.test.testCard import org.luxons.sevenwonders.engine.test.testSettings import org.luxons.sevenwonders.engine.wonders.Wonder +import org.luxons.sevenwonders.model.cards.Color +import org.luxons.sevenwonders.model.resources.ResourceType +import org.luxons.sevenwonders.model.resources.noTransactions import kotlin.test.assertEquals class CardTest { diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/HandsTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/HandsTest.kt index b8491434..f7bb45c0 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/HandsTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/HandsTest.kt @@ -8,9 +8,9 @@ import org.junit.experimental.theories.Theories import org.junit.experimental.theories.Theory import org.junit.runner.RunWith import org.luxons.sevenwonders.engine.SimplePlayer -import org.luxons.sevenwonders.model.cards.HandRotationDirection import org.luxons.sevenwonders.engine.test.sampleCards import org.luxons.sevenwonders.engine.test.testTable +import org.luxons.sevenwonders.model.cards.HandRotationDirection import kotlin.test.assertEquals import kotlin.test.assertFailsWith import kotlin.test.assertFalse diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/RequirementsTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/RequirementsTest.kt index 27b3cad0..889675a4 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/RequirementsTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/RequirementsTest.kt @@ -8,14 +8,14 @@ import org.junit.experimental.theories.Theory import org.junit.runner.RunWith import org.luxons.sevenwonders.engine.SimplePlayer import org.luxons.sevenwonders.engine.boards.Table -import org.luxons.sevenwonders.model.resources.Provider -import org.luxons.sevenwonders.model.resources.ResourceType import org.luxons.sevenwonders.engine.resources.emptyResources -import org.luxons.sevenwonders.model.resources.noTransactions import org.luxons.sevenwonders.engine.test.createRequirements import org.luxons.sevenwonders.engine.test.createTransactions import org.luxons.sevenwonders.engine.test.singleBoardPlayer import org.luxons.sevenwonders.engine.test.testBoard +import org.luxons.sevenwonders.model.resources.Provider +import org.luxons.sevenwonders.model.resources.ResourceType +import org.luxons.sevenwonders.model.resources.noTransactions import kotlin.test.assertEquals import kotlin.test.assertSame import kotlin.test.assertTrue diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/ProductionIncreaseSerializerTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/ProductionIncreaseSerializerTest.kt index 709f2a87..664ccedc 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/ProductionIncreaseSerializerTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/ProductionIncreaseSerializerTest.kt @@ -9,8 +9,8 @@ import org.junit.Test import org.luxons.sevenwonders.engine.effects.ProductionIncrease import org.luxons.sevenwonders.engine.resources.MutableResources import org.luxons.sevenwonders.engine.resources.Production -import org.luxons.sevenwonders.model.resources.ResourceType import org.luxons.sevenwonders.engine.resources.Resources +import org.luxons.sevenwonders.model.resources.ResourceType import kotlin.test.assertEquals import kotlin.test.assertFailsWith import kotlin.test.assertNull diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/ProductionSerializerTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/ProductionSerializerTest.kt index 4af1d900..4a58e493 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/ProductionSerializerTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/ProductionSerializerTest.kt @@ -8,8 +8,8 @@ import org.junit.Before import org.junit.Test import org.luxons.sevenwonders.engine.resources.MutableResources import org.luxons.sevenwonders.engine.resources.Production -import org.luxons.sevenwonders.model.resources.ResourceType import org.luxons.sevenwonders.engine.resources.Resources +import org.luxons.sevenwonders.model.resources.ResourceType import kotlin.test.assertEquals import kotlin.test.assertFailsWith import kotlin.test.assertNull diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/ResourcesSerializerTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/ResourcesSerializerTest.kt index c8074f2d..8a7e4f98 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/ResourcesSerializerTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/ResourcesSerializerTest.kt @@ -6,12 +6,12 @@ import com.google.gson.GsonBuilder import org.junit.Before import org.junit.Test import org.luxons.sevenwonders.engine.resources.MutableResources -import org.luxons.sevenwonders.model.resources.ResourceType.CLAY -import org.luxons.sevenwonders.model.resources.ResourceType.STONE -import org.luxons.sevenwonders.model.resources.ResourceType.WOOD import org.luxons.sevenwonders.engine.resources.Resources import org.luxons.sevenwonders.engine.resources.emptyResources import org.luxons.sevenwonders.engine.resources.resourcesOf +import org.luxons.sevenwonders.model.resources.ResourceType.CLAY +import org.luxons.sevenwonders.model.resources.ResourceType.STONE +import org.luxons.sevenwonders.model.resources.ResourceType.WOOD import kotlin.test.assertEquals import kotlin.test.assertNull diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/BonusPerBoardElementTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/BonusPerBoardElementTest.kt index ce914aab..1bb92f13 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/BonusPerBoardElementTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/BonusPerBoardElementTest.kt @@ -7,12 +7,12 @@ import org.junit.experimental.theories.Theory import org.junit.runner.RunWith import org.luxons.sevenwonders.engine.Player import org.luxons.sevenwonders.engine.SimplePlayer -import org.luxons.sevenwonders.model.boards.RelativeBoardPosition import org.luxons.sevenwonders.engine.boards.Table -import org.luxons.sevenwonders.model.cards.CardBack -import org.luxons.sevenwonders.model.cards.Color import org.luxons.sevenwonders.engine.test.addCards import org.luxons.sevenwonders.engine.test.testTable +import org.luxons.sevenwonders.model.boards.RelativeBoardPosition +import org.luxons.sevenwonders.model.cards.CardBack +import org.luxons.sevenwonders.model.cards.Color import kotlin.test.assertEquals @RunWith(Theories::class) diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/DiscountTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/DiscountTest.kt index d989d24a..7df5ac35 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/DiscountTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/DiscountTest.kt @@ -5,10 +5,10 @@ import org.junit.experimental.theories.DataPoints import org.junit.experimental.theories.Theories import org.junit.experimental.theories.Theory import org.junit.runner.RunWith -import org.luxons.sevenwonders.model.resources.Provider -import org.luxons.sevenwonders.model.resources.ResourceType import org.luxons.sevenwonders.engine.test.createTransactions import org.luxons.sevenwonders.engine.test.testBoard +import org.luxons.sevenwonders.model.resources.Provider +import org.luxons.sevenwonders.model.resources.ResourceType import kotlin.test.assertEquals @RunWith(Theories::class) diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/GoldIncreaseTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/GoldIncreaseTest.kt index 67bb3862..59e8d48e 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/GoldIncreaseTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/GoldIncreaseTest.kt @@ -5,9 +5,9 @@ import org.junit.experimental.theories.Theories import org.junit.experimental.theories.Theory import org.junit.runner.RunWith import org.luxons.sevenwonders.engine.SimplePlayer -import org.luxons.sevenwonders.model.resources.ResourceType import org.luxons.sevenwonders.engine.test.testBoard import org.luxons.sevenwonders.engine.test.testTable +import org.luxons.sevenwonders.model.resources.ResourceType import kotlin.test.assertEquals @RunWith(Theories::class) diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/MilitaryReinforcementsTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/MilitaryReinforcementsTest.kt index 23b5959e..f8e30b5a 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/MilitaryReinforcementsTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/MilitaryReinforcementsTest.kt @@ -5,9 +5,9 @@ import org.junit.experimental.theories.Theories import org.junit.experimental.theories.Theory import org.junit.runner.RunWith import org.luxons.sevenwonders.engine.SimplePlayer -import org.luxons.sevenwonders.model.resources.ResourceType import org.luxons.sevenwonders.engine.test.testBoard import org.luxons.sevenwonders.engine.test.testTable +import org.luxons.sevenwonders.model.resources.ResourceType import kotlin.test.assertEquals @RunWith(Theories::class) diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/ProductionIncreaseTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/ProductionIncreaseTest.kt index 235b2fa7..699803d0 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/ProductionIncreaseTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/ProductionIncreaseTest.kt @@ -5,11 +5,11 @@ import org.junit.experimental.theories.Theories import org.junit.experimental.theories.Theory import org.junit.runner.RunWith import org.luxons.sevenwonders.engine.SimplePlayer -import org.luxons.sevenwonders.model.resources.ResourceType import org.luxons.sevenwonders.engine.resources.resourcesOf import org.luxons.sevenwonders.engine.test.fixedProduction import org.luxons.sevenwonders.engine.test.testBoard import org.luxons.sevenwonders.engine.test.testTable +import org.luxons.sevenwonders.model.resources.ResourceType import kotlin.test.assertEquals import kotlin.test.assertFalse import kotlin.test.assertTrue diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/ScienceProgressTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/ScienceProgressTest.kt index b7f5e152..551018fc 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/ScienceProgressTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/ScienceProgressTest.kt @@ -5,10 +5,10 @@ import org.junit.experimental.theories.Theories import org.junit.experimental.theories.Theory import org.junit.runner.RunWith import org.luxons.sevenwonders.engine.boards.ScienceType -import org.luxons.sevenwonders.model.resources.ResourceType import org.luxons.sevenwonders.engine.test.createScience import org.luxons.sevenwonders.engine.test.createScienceProgress import org.luxons.sevenwonders.engine.test.testBoard +import org.luxons.sevenwonders.model.resources.ResourceType import kotlin.test.assertEquals @RunWith(Theories::class) diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/SpecialAbilityActivationTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/SpecialAbilityActivationTest.kt index 5a996369..6931e38f 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/SpecialAbilityActivationTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/SpecialAbilityActivationTest.kt @@ -7,11 +7,11 @@ import org.junit.experimental.theories.Theories import org.junit.experimental.theories.Theory import org.junit.runner.RunWith import org.luxons.sevenwonders.engine.SimplePlayer -import org.luxons.sevenwonders.model.boards.RelativeBoardPosition import org.luxons.sevenwonders.engine.cards.Card -import org.luxons.sevenwonders.model.cards.Color import org.luxons.sevenwonders.engine.test.createGuildCard import org.luxons.sevenwonders.engine.test.testTable +import org.luxons.sevenwonders.model.boards.RelativeBoardPosition +import org.luxons.sevenwonders.model.cards.Color import kotlin.test.assertEquals import kotlin.test.assertFailsWith import kotlin.test.assertTrue diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/moves/BuildWonderMoveTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/moves/BuildWonderMoveTest.kt index 8ff9aa33..a935fa7e 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/moves/BuildWonderMoveTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/moves/BuildWonderMoveTest.kt @@ -2,7 +2,6 @@ package org.luxons.sevenwonders.engine.moves import org.junit.Test import org.luxons.sevenwonders.engine.PlayerContext -import org.luxons.sevenwonders.model.MoveType import org.luxons.sevenwonders.engine.boards.Table import org.luxons.sevenwonders.engine.cards.Card import org.luxons.sevenwonders.engine.test.createMove @@ -10,6 +9,7 @@ import org.luxons.sevenwonders.engine.test.sampleCards import org.luxons.sevenwonders.engine.test.testCard import org.luxons.sevenwonders.engine.test.testSettings import org.luxons.sevenwonders.engine.test.testTable +import org.luxons.sevenwonders.model.MoveType import org.luxons.sevenwonders.model.Settings import kotlin.test.assertEquals import kotlin.test.assertFailsWith diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/resources/BestPriceCalculatorTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/resources/BestPriceCalculatorTest.kt index a003a332..ba0fdf1b 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/resources/BestPriceCalculatorTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/resources/BestPriceCalculatorTest.kt @@ -3,6 +3,10 @@ package org.luxons.sevenwonders.engine.resources import org.junit.Test import org.luxons.sevenwonders.engine.SimplePlayer import org.luxons.sevenwonders.engine.boards.Table +import org.luxons.sevenwonders.engine.test.createTransaction +import org.luxons.sevenwonders.engine.test.createTransactions +import org.luxons.sevenwonders.engine.test.testBoard +import org.luxons.sevenwonders.engine.test.testTable import org.luxons.sevenwonders.model.resources.Provider.LEFT_PLAYER import org.luxons.sevenwonders.model.resources.Provider.RIGHT_PLAYER import org.luxons.sevenwonders.model.resources.ResourceTransactions @@ -12,10 +16,6 @@ import org.luxons.sevenwonders.model.resources.ResourceType.ORE import org.luxons.sevenwonders.model.resources.ResourceType.STONE import org.luxons.sevenwonders.model.resources.ResourceType.WOOD import org.luxons.sevenwonders.model.resources.noTransactions -import org.luxons.sevenwonders.engine.test.createTransaction -import org.luxons.sevenwonders.engine.test.createTransactions -import org.luxons.sevenwonders.engine.test.testBoard -import org.luxons.sevenwonders.engine.test.testTable import kotlin.test.assertEquals class BestPriceCalculatorTest { diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/resources/ResourceTransactionsTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/resources/ResourceTransactionsTest.kt index 665612e3..71c75d70 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/resources/ResourceTransactionsTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/resources/ResourceTransactionsTest.kt @@ -1,11 +1,11 @@ package org.luxons.sevenwonders.engine.resources import org.junit.Test +import org.luxons.sevenwonders.engine.test.createTransaction import org.luxons.sevenwonders.model.resources.Provider import org.luxons.sevenwonders.model.resources.ResourceType import org.luxons.sevenwonders.model.resources.ResourceType.CLAY import org.luxons.sevenwonders.model.resources.ResourceType.WOOD -import org.luxons.sevenwonders.engine.test.createTransaction import kotlin.test.assertEquals class ResourceTransactionsTest { diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/resources/TradingRulesTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/resources/TradingRulesTest.kt index 0301b16c..0b2e5261 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/resources/TradingRulesTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/resources/TradingRulesTest.kt @@ -5,11 +5,11 @@ import org.junit.experimental.theories.DataPoints import org.junit.experimental.theories.Theories import org.junit.experimental.theories.Theory import org.junit.runner.RunWith +import org.luxons.sevenwonders.engine.test.createTransaction +import org.luxons.sevenwonders.engine.test.createTransactions import org.luxons.sevenwonders.model.resources.Provider import org.luxons.sevenwonders.model.resources.ResourceType import org.luxons.sevenwonders.model.resources.noTransactions -import org.luxons.sevenwonders.engine.test.createTransaction -import org.luxons.sevenwonders.engine.test.createTransactions import kotlin.test.assertEquals @RunWith(Theories::class) diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/wonders/WonderTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/wonders/WonderTest.kt index 1857ebe8..b354f1b4 100644 --- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/wonders/WonderTest.kt +++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/wonders/WonderTest.kt @@ -1,8 +1,8 @@ package org.luxons.sevenwonders.engine.wonders import org.junit.Test -import org.luxons.sevenwonders.model.cards.CardBack import org.luxons.sevenwonders.engine.test.testWonder +import org.luxons.sevenwonders.model.cards.CardBack import kotlin.test.assertEquals import kotlin.test.assertFailsWith diff --git a/sw-server/build.gradle.kts b/sw-server/build.gradle.kts index aca53bb2..9ae670b6 100644 --- a/sw-server/build.gradle.kts +++ b/sw-server/build.gradle.kts @@ -2,7 +2,6 @@ plugins { kotlin("jvm") kotlin("plugin.spring") id("org.springframework.boot") version "2.3.3.RELEASE" - id("org.jlleitschuh.gradle.ktlint") } apply(plugin = "io.spring.dependency-management") diff --git a/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/SevenWondersTest.kt b/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/SevenWondersTest.kt index b4bfbd9d..0150258c 100644 --- a/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/SevenWondersTest.kt +++ b/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/SevenWondersTest.kt @@ -1,7 +1,11 @@ package org.luxons.sevenwonders.server -import kotlinx.coroutines.* +import kotlinx.coroutines.FlowPreview +import kotlinx.coroutines.delay import kotlinx.coroutines.flow.produceIn +import kotlinx.coroutines.launch +import kotlinx.coroutines.withTimeout +import kotlinx.coroutines.withTimeoutOrNull import org.junit.runner.RunWith import org.luxons.sevenwonders.client.SevenWondersClient import org.luxons.sevenwonders.client.SevenWondersSession @@ -10,7 +14,10 @@ import org.springframework.boot.test.context.SpringBootTest import org.springframework.boot.test.context.SpringBootTest.WebEnvironment import org.springframework.boot.web.server.LocalServerPort import org.springframework.test.context.junit4.SpringRunner -import kotlin.test.* +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertNull @OptIn(FlowPreview::class) @RunWith(SpringRunner::class) diff --git a/sw-ui/build.gradle.kts b/sw-ui/build.gradle.kts index 78aa9d6b..0753b629 100644 --- a/sw-ui/build.gradle.kts +++ b/sw-ui/build.gradle.kts @@ -2,7 +2,6 @@ import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpack plugins { kotlin("js") - id("org.jlleitschuh.gradle.ktlint") } repositories { diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/GlobalStyles.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/GlobalStyles.kt index f5d76dd7..1477dd98 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/GlobalStyles.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/GlobalStyles.kt @@ -1,8 +1,7 @@ package org.luxons.sevenwonders.ui.components import kotlinx.css.* -import kotlinx.css.properties.transform -import kotlinx.css.properties.translate +import kotlinx.css.properties.* import styled.StyleSheet object GlobalStyles : StyleSheet("GlobalStyles", isStatic = true) { diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/ProductionBar.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/ProductionBar.kt index b7684b2b..507883e7 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/ProductionBar.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/ProductionBar.kt @@ -17,8 +17,7 @@ import kotlinx.css.height import kotlinx.css.margin import kotlinx.css.marginLeft import kotlinx.css.position -import kotlinx.css.properties.borderTop -import kotlinx.css.properties.boxShadow +import kotlinx.css.properties.* import kotlinx.css.px import kotlinx.css.rem import kotlinx.css.verticalAlign diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/lobby/Lobby.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/lobby/Lobby.kt index f0c11465..d304880f 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/lobby/Lobby.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/lobby/Lobby.kt @@ -1,14 +1,28 @@ package org.luxons.sevenwonders.ui.components.lobby -import com.palantir.blueprintjs.* +import com.palantir.blueprintjs.Elevation +import com.palantir.blueprintjs.Intent +import com.palantir.blueprintjs.bpButton +import com.palantir.blueprintjs.bpButtonGroup +import com.palantir.blueprintjs.bpCard +import com.palantir.blueprintjs.bpDivider +import com.palantir.blueprintjs.bpNonIdealState import kotlinx.css.* import kotlinx.css.properties.* import org.luxons.sevenwonders.model.api.LobbyDTO import org.luxons.sevenwonders.model.api.PlayerDTO -import org.luxons.sevenwonders.model.wonders.* +import org.luxons.sevenwonders.model.wonders.AssignedWonder +import org.luxons.sevenwonders.model.wonders.WonderSide +import org.luxons.sevenwonders.model.wonders.deal import org.luxons.sevenwonders.model.wonders.withRandomSide +import org.luxons.sevenwonders.model.wonders.withSide import org.luxons.sevenwonders.ui.components.GlobalStyles -import org.luxons.sevenwonders.ui.redux.* +import org.luxons.sevenwonders.ui.redux.RequestAddBot +import org.luxons.sevenwonders.ui.redux.RequestLeaveLobby +import org.luxons.sevenwonders.ui.redux.RequestReassignWonders +import org.luxons.sevenwonders.ui.redux.RequestReorderPlayers +import org.luxons.sevenwonders.ui.redux.RequestStartGame +import org.luxons.sevenwonders.ui.redux.connectStateAndDispatch import react.RBuilder import react.RComponent import react.RProps -- cgit