From 294eb9ecff50e4a57734ef955917a925d0513aa9 Mon Sep 17 00:00:00 2001 From: "anastasia.birillo" Date: Wed, 13 Dec 2023 20:37:44 +0100 Subject: [PATCH] Fix detekt --- .../kotlin/course/mastermind/advanced/Main.kt | 2 +- .../kotlin/course/mastermind/advanced/Util.kt | 2 +- .../CompleteTheProject/test/Tests.kt | 2 +- .../kotlin/course/mastermind/advanced/Main.kt | 2 +- .../kotlin/course/mastermind/advanced/Util.kt | 2 +- .../kotlin/course/mastermind/advanced/Main.kt | 2 +- .../kotlin/course/mastermind/advanced/Util.kt | 2 +- .../kotlin/course/mastermind/advanced/Main.kt | 2 +- .../kotlin/course/mastermind/advanced/Util.kt | 2 +- .../kotlin/course/mastermind/advanced/Main.kt | 2 +- .../kotlin/course/mastermind/advanced/Util.kt | 2 +- .../kotlin/course/mastermind/advanced/Main.kt | 2 +- .../kotlin/course/mastermind/advanced/Util.kt | 2 +- .../kotlin/course/mastermind/advanced/Main.kt | 2 +- .../kotlin/course/mastermind/advanced/Util.kt | 2 +- .../kotlin/course/mastermind/advanced/Main.kt | 2 +- .../kotlin/course/mastermind/advanced/Util.kt | 2 +- .../safeUserInputFunction/test/Tests.kt | 9 +++--- detekt.yml | 28 ++----------------- .../kotlin/course/gifs/warmup/runners/Game.kt | 6 ++-- .../gifs/warmup/runners/SafeUserInput.kt | 2 +- 21 files changed, 27 insertions(+), 52 deletions(-) diff --git a/MastermindAdvanced/CompleteTheProject/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt b/MastermindAdvanced/CompleteTheProject/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt index 563503ed..d6a8c95a 100644 --- a/MastermindAdvanced/CompleteTheProject/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt +++ b/MastermindAdvanced/CompleteTheProject/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt @@ -1,4 +1,4 @@ -package jetbrains.kotlin.course.warmup +package jetbrains.kotlin.course.mastermind.advanced fun getGameRules(wordLength: Int, maxAttemptsCount: Int, secretExample: String) = "Welcome to the game! $newLineSymbol" + diff --git a/MastermindAdvanced/CompleteTheProject/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt b/MastermindAdvanced/CompleteTheProject/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt index dec35107..261e4b93 100644 --- a/MastermindAdvanced/CompleteTheProject/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt +++ b/MastermindAdvanced/CompleteTheProject/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt @@ -1,4 +1,4 @@ -package jetbrains.kotlin.course.warmup +package jetbrains.kotlin.course.mastermind.advanced fun safeReadLine() = readlnOrNull() ?: error("Your input is incorrect, sorry") diff --git a/MastermindAdvanced/CompleteTheProject/test/Tests.kt b/MastermindAdvanced/CompleteTheProject/test/Tests.kt index e12ccb1b..c99b326e 100644 --- a/MastermindAdvanced/CompleteTheProject/test/Tests.kt +++ b/MastermindAdvanced/CompleteTheProject/test/Tests.kt @@ -1,4 +1,4 @@ -import jetbrains.kotlin.course.warmup.newLineSymbol +import jetbrains.kotlin.course.mastermind.advanced.newLineSymbol import org.jetbrains.academy.test.system.core.invokeWithArgs import org.jetbrains.academy.test.system.core.models.classes.findClassSafe import org.junit.jupiter.api.Assertions diff --git a/MastermindAdvanced/errorHandling/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt b/MastermindAdvanced/errorHandling/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt index ce6564c1..6fc9c885 100644 --- a/MastermindAdvanced/errorHandling/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt +++ b/MastermindAdvanced/errorHandling/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt @@ -1,4 +1,4 @@ -package jetbrains.kotlin.course.warmup +package jetbrains.kotlin.course.mastermind.advanced fun getGameRules(wordLength: Int, maxAttemptsCount: Int, secretExample: String) = "Welcome to the game! $newLineSymbol" + diff --git a/MastermindAdvanced/errorHandling/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt b/MastermindAdvanced/errorHandling/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt index dec35107..261e4b93 100644 --- a/MastermindAdvanced/errorHandling/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt +++ b/MastermindAdvanced/errorHandling/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt @@ -1,4 +1,4 @@ -package jetbrains.kotlin.course.warmup +package jetbrains.kotlin.course.mastermind.advanced fun safeReadLine() = readlnOrNull() ?: error("Your input is incorrect, sorry") diff --git a/MastermindAdvanced/generateSecretFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt b/MastermindAdvanced/generateSecretFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt index ce6564c1..6fc9c885 100644 --- a/MastermindAdvanced/generateSecretFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt +++ b/MastermindAdvanced/generateSecretFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt @@ -1,4 +1,4 @@ -package jetbrains.kotlin.course.warmup +package jetbrains.kotlin.course.mastermind.advanced fun getGameRules(wordLength: Int, maxAttemptsCount: Int, secretExample: String) = "Welcome to the game! $newLineSymbol" + diff --git a/MastermindAdvanced/generateSecretFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt b/MastermindAdvanced/generateSecretFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt index dec35107..261e4b93 100644 --- a/MastermindAdvanced/generateSecretFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt +++ b/MastermindAdvanced/generateSecretFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt @@ -1,4 +1,4 @@ -package jetbrains.kotlin.course.warmup +package jetbrains.kotlin.course.mastermind.advanced fun safeReadLine() = readlnOrNull() ?: error("Your input is incorrect, sorry") diff --git a/MastermindAdvanced/introduction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt b/MastermindAdvanced/introduction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt index 94c18d74..1e53571d 100644 --- a/MastermindAdvanced/introduction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt +++ b/MastermindAdvanced/introduction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt @@ -1,4 +1,4 @@ -package jetbrains.kotlin.course.warmup +package jetbrains.kotlin.course.mastermind.advanced fun getGameRules(wordLength: Int, maxAttemptsCount: Int, secretExample: String) = "Welcome to the game! $newLineSymbol" + diff --git a/MastermindAdvanced/introduction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt b/MastermindAdvanced/introduction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt index dec35107..261e4b93 100644 --- a/MastermindAdvanced/introduction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt +++ b/MastermindAdvanced/introduction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt @@ -1,4 +1,4 @@ -package jetbrains.kotlin.course.warmup +package jetbrains.kotlin.course.mastermind.advanced fun safeReadLine() = readlnOrNull() ?: error("Your input is incorrect, sorry") diff --git a/MastermindAdvanced/isCorrectInputFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt b/MastermindAdvanced/isCorrectInputFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt index 2fb63ac3..0826e0d6 100644 --- a/MastermindAdvanced/isCorrectInputFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt +++ b/MastermindAdvanced/isCorrectInputFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt @@ -1,4 +1,4 @@ -package jetbrains.kotlin.course.warmup +package jetbrains.kotlin.course.mastermind.advanced fun getGameRules(wordLength: Int, maxAttemptsCount: Int, secretExample: String) = "Welcome to the game! $newLineSymbol" + diff --git a/MastermindAdvanced/isCorrectInputFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt b/MastermindAdvanced/isCorrectInputFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt index dec35107..261e4b93 100644 --- a/MastermindAdvanced/isCorrectInputFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt +++ b/MastermindAdvanced/isCorrectInputFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt @@ -1,4 +1,4 @@ -package jetbrains.kotlin.course.warmup +package jetbrains.kotlin.course.mastermind.advanced fun safeReadLine() = readlnOrNull() ?: error("Your input is incorrect, sorry") diff --git a/MastermindAdvanced/joinToStringFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt b/MastermindAdvanced/joinToStringFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt index 94c18d74..1e53571d 100644 --- a/MastermindAdvanced/joinToStringFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt +++ b/MastermindAdvanced/joinToStringFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt @@ -1,4 +1,4 @@ -package jetbrains.kotlin.course.warmup +package jetbrains.kotlin.course.mastermind.advanced fun getGameRules(wordLength: Int, maxAttemptsCount: Int, secretExample: String) = "Welcome to the game! $newLineSymbol" + diff --git a/MastermindAdvanced/joinToStringFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt b/MastermindAdvanced/joinToStringFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt index dec35107..261e4b93 100644 --- a/MastermindAdvanced/joinToStringFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt +++ b/MastermindAdvanced/joinToStringFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt @@ -1,4 +1,4 @@ -package jetbrains.kotlin.course.warmup +package jetbrains.kotlin.course.mastermind.advanced fun safeReadLine() = readlnOrNull() ?: error("Your input is incorrect, sorry") diff --git a/MastermindAdvanced/randomFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt b/MastermindAdvanced/randomFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt index 94c18d74..1e53571d 100644 --- a/MastermindAdvanced/randomFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt +++ b/MastermindAdvanced/randomFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt @@ -1,4 +1,4 @@ -package jetbrains.kotlin.course.warmup +package jetbrains.kotlin.course.mastermind.advanced fun getGameRules(wordLength: Int, maxAttemptsCount: Int, secretExample: String) = "Welcome to the game! $newLineSymbol" + diff --git a/MastermindAdvanced/randomFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt b/MastermindAdvanced/randomFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt index dec35107..261e4b93 100644 --- a/MastermindAdvanced/randomFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt +++ b/MastermindAdvanced/randomFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt @@ -1,4 +1,4 @@ -package jetbrains.kotlin.course.warmup +package jetbrains.kotlin.course.mastermind.advanced fun safeReadLine() = readlnOrNull() ?: error("Your input is incorrect, sorry") diff --git a/MastermindAdvanced/safeUserInputFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt b/MastermindAdvanced/safeUserInputFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt index b80ac1db..39925c4b 100644 --- a/MastermindAdvanced/safeUserInputFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt +++ b/MastermindAdvanced/safeUserInputFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Main.kt @@ -1,4 +1,4 @@ -package jetbrains.kotlin.course.warmup +package jetbrains.kotlin.course.mastermind.advanced fun getGameRules(wordLength: Int, maxAttemptsCount: Int, secretExample: String) = "Welcome to the game! $newLineSymbol" + diff --git a/MastermindAdvanced/safeUserInputFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt b/MastermindAdvanced/safeUserInputFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt index dec35107..261e4b93 100644 --- a/MastermindAdvanced/safeUserInputFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt +++ b/MastermindAdvanced/safeUserInputFunction/src/main/kotlin/jetbrains/kotlin/course/mastermind/advanced/Util.kt @@ -1,4 +1,4 @@ -package jetbrains.kotlin.course.warmup +package jetbrains.kotlin.course.mastermind.advanced fun safeReadLine() = readlnOrNull() ?: error("Your input is incorrect, sorry") diff --git a/MastermindAdvanced/safeUserInputFunction/test/Tests.kt b/MastermindAdvanced/safeUserInputFunction/test/Tests.kt index 8d9e60c9..3666daaf 100644 --- a/MastermindAdvanced/safeUserInputFunction/test/Tests.kt +++ b/MastermindAdvanced/safeUserInputFunction/test/Tests.kt @@ -1,6 +1,5 @@ -import jetbrains.kotlin.course.warmup.newLineSymbol +import jetbrains.kotlin.course.mastermind.advanced.newLineSymbol import org.jetbrains.academy.test.system.core.invokeWithArgs -import org.jetbrains.academy.test.system.core.invokeWithoutArgs import org.jetbrains.academy.test.system.core.models.classes.findClassSafe import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.BeforeAll @@ -79,9 +78,9 @@ class Test { @JvmStatic fun safeUserInputs() = listOf( // systemIn, output, isSystemInEmpty - Arguments.of("ABC${newLineSymbol}ABCCC${newLineSymbol}ABCI${newLineSymbol}ACI${newLineSymbol}ABCD${newLineSymbol}", "ABCD", true), - Arguments.of("ABCD${newLineSymbol}", "ABCD", true), - Arguments.of("ABCD${newLineSymbol}ABC${newLineSymbol}ABCCC${newLineSymbol}ABCI${newLineSymbol}ACI${newLineSymbol}", "ABCD", false), + Arguments.of("ABC${newLineSymbol}ABCCC${newLineSymbol}ABCI${newLineSymbol}ACI${newLineSymbol}ABCD$newLineSymbol", "ABCD", true), + Arguments.of("ABCD$newLineSymbol", "ABCD", true), + Arguments.of("ABCD${newLineSymbol}ABC${newLineSymbol}ABCCC${newLineSymbol}ABCI${newLineSymbol}ACI$newLineSymbol", "ABCD", false), ) } diff --git a/detekt.yml b/detekt.yml index 1182cb9d..2ba34cd1 100644 --- a/detekt.yml +++ b/detekt.yml @@ -15,33 +15,9 @@ style: MagicNumber: active: false UnusedPrivateMember: - active: true - excludes: [ - "**/AlmostDone/StringFunctions/src/main/kotlin/jetbrains/kotlin/course/almost/done/Main.kt", - "**/AlmostDone/When/src/main/kotlin/jetbrains/kotlin/course/almost/done/Main.kt", - "**/TheFirstDateWithProgramming/ReadUserInput/src/main/kotlin/jetbrains/kotlin/course/first/date/Main.kt", - "**/TheFirstDateWithProgramming/Variables/src/main/kotlin/jetbrains/kotlin/course/first/date/Main.kt", - "**/TheFirstDateWithProgramming/comments/src/main/kotlin/jetbrains/kotlin/course/first/date/Main.kt", - "**/TheFirstDateWithProgramming/readUserInputTheory/src/main/kotlin/jetbrains/kotlin/course/first/date/Main.kt", - "**/Chat/askFirstQuestion/src/main/kotlin/jetbrains/kotlin/course/chat/Main.kt", - "**/Chat/askSecondQuestion/src/main/kotlin/jetbrains/kotlin/course/chat/Main.kt", - "**/WarmUp/Collections/src/main/kotlin/jetbrains/kotlin/course/warmup/Main.kt", - "**/WarmUp/CollectionsPartTwo/src/main/kotlin/jetbrains/kotlin/course/warmup/Main.kt", - "**/WarmUp/CustomFunctions/src/main/kotlin/jetbrains/kotlin/course/warmup/Main.kt", - "**/WarmUp/If/src/main/kotlin/jetbrains/kotlin/course/warmup/Main.kt", - "**/WarmUp/Loops/src/main/kotlin/jetbrains/kotlin/course/warmup/Main.kt", - - ] + active: false FunctionOnlyReturningConstant: - active: true - excludes: [ - "**/WarmUp/Collections/src/main/kotlin/jetbrains/kotlin/course/warmup/Main.kt", - "**/WarmUp/CollectionsPartTwo/src/main/kotlin/jetbrains/kotlin/course/warmup/Main.kt", - "**/WarmUp/CustomFunctions/src/main/kotlin/jetbrains/kotlin/course/warmup/Main.kt", - "**/WarmUp/FinishBaseGame/src/main/kotlin/jetbrains/kotlin/course/warmup/Main.kt", - "**/WarmUp/If/src/main/kotlin/jetbrains/kotlin/course/warmup/Main.kt", - "**/WarmUp/Loops/src/main/kotlin/jetbrains/kotlin/course/warmup/Main.kt", - ] + active: false complexity: TooManyFunctions: diff --git a/gifs/src/main/kotlin/jetbrains/kotlin/course/gifs/warmup/runners/Game.kt b/gifs/src/main/kotlin/jetbrains/kotlin/course/gifs/warmup/runners/Game.kt index d9b85ad4..43754b52 100644 --- a/gifs/src/main/kotlin/jetbrains/kotlin/course/gifs/warmup/runners/Game.kt +++ b/gifs/src/main/kotlin/jetbrains/kotlin/course/gifs/warmup/runners/Game.kt @@ -1,13 +1,13 @@ package jetbrains.kotlin.course.gifs.warmup.runners -import jetbrains.kotlin.course.warmup.getGameRules -import jetbrains.kotlin.course.warmup.playGame +import jetbrains.kotlin.course.mastermind.advanced.getGameRules +import jetbrains.kotlin.course.mastermind.advanced.playGame fun main() { val wordLength = 4 val maxAttemptsCount = 3 val secretExample = "ACEB" val alphabet = "ABCDEFGH" - println(getGameRules(wordLength, maxAttemptsCount, secretExample, alphabet).replace(". ", ".\n")) + println(getGameRules(wordLength, maxAttemptsCount, secretExample).replace(". ", ".\n")) playGame("BBDH", wordLength, maxAttemptsCount, alphabet) } diff --git a/gifs/src/main/kotlin/jetbrains/kotlin/course/gifs/warmup/runners/SafeUserInput.kt b/gifs/src/main/kotlin/jetbrains/kotlin/course/gifs/warmup/runners/SafeUserInput.kt index 5e3621c4..7ebc7d7c 100644 --- a/gifs/src/main/kotlin/jetbrains/kotlin/course/gifs/warmup/runners/SafeUserInput.kt +++ b/gifs/src/main/kotlin/jetbrains/kotlin/course/gifs/warmup/runners/SafeUserInput.kt @@ -1,6 +1,6 @@ package jetbrains.kotlin.course.gifs.warmup.runners -import jetbrains.kotlin.course.warmup.safeUserInput +import jetbrains.kotlin.course.mastermind.advanced.safeUserInput fun main() { safeUserInput(4, "ABCDEFGH")