Skip to content

Commit

Permalink
Fix detekt
Browse files Browse the repository at this point in the history
  • Loading branch information
nbirillo committed Dec 13, 2023
1 parent bae05ab commit 294eb9e
Show file tree
Hide file tree
Showing 21 changed files with 27 additions and 52 deletions.
Original file line number Diff line number Diff line change
@@ -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" +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package jetbrains.kotlin.course.warmup
package jetbrains.kotlin.course.mastermind.advanced

fun safeReadLine() = readlnOrNull() ?: error("Your input is incorrect, sorry")

Expand Down
2 changes: 1 addition & 1 deletion MastermindAdvanced/CompleteTheProject/test/Tests.kt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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" +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package jetbrains.kotlin.course.warmup
package jetbrains.kotlin.course.mastermind.advanced

fun safeReadLine() = readlnOrNull() ?: error("Your input is incorrect, sorry")

Expand Down
Original file line number Diff line number Diff line change
@@ -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" +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package jetbrains.kotlin.course.warmup
package jetbrains.kotlin.course.mastermind.advanced

fun safeReadLine() = readlnOrNull() ?: error("Your input is incorrect, sorry")

Expand Down
Original file line number Diff line number Diff line change
@@ -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" +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package jetbrains.kotlin.course.warmup
package jetbrains.kotlin.course.mastermind.advanced

fun safeReadLine() = readlnOrNull() ?: error("Your input is incorrect, sorry")

Expand Down
Original file line number Diff line number Diff line change
@@ -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" +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package jetbrains.kotlin.course.warmup
package jetbrains.kotlin.course.mastermind.advanced

fun safeReadLine() = readlnOrNull() ?: error("Your input is incorrect, sorry")

Expand Down
Original file line number Diff line number Diff line change
@@ -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" +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package jetbrains.kotlin.course.warmup
package jetbrains.kotlin.course.mastermind.advanced

fun safeReadLine() = readlnOrNull() ?: error("Your input is incorrect, sorry")

Expand Down
Original file line number Diff line number Diff line change
@@ -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" +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package jetbrains.kotlin.course.warmup
package jetbrains.kotlin.course.mastermind.advanced

fun safeReadLine() = readlnOrNull() ?: error("Your input is incorrect, sorry")

Expand Down
Original file line number Diff line number Diff line change
@@ -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" +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package jetbrains.kotlin.course.warmup
package jetbrains.kotlin.course.mastermind.advanced

fun safeReadLine() = readlnOrNull() ?: error("Your input is incorrect, sorry")

Expand Down
9 changes: 4 additions & 5 deletions MastermindAdvanced/safeUserInputFunction/test/Tests.kt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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),
)
}

Expand Down
28 changes: 2 additions & 26 deletions detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
}
Original file line number Diff line number Diff line change
@@ -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")
Expand Down

0 comments on commit 294eb9e

Please sign in to comment.