feat: Suppress SonarQube warnings for ZobristHash and PolyglotBook and improve coverage configuration
Build & Test (NowChessSystems) TeamCity build failed

This commit is contained in:
2026-04-17 22:49:41 +02:00
parent 6fb78daacb
commit 261dc0da49
3 changed files with 3 additions and 14 deletions
-14
View File
@@ -22,20 +22,6 @@ sonar {
}.joinToString(",")
property("sonar.scala.coverage.reportPaths", scoverageReports)
property(
"sonar.issue.ignore.multicriteria",
"bot-zobrist-s2245,bot-polyglot-s2245"
)
property("sonar.issue.ignore.multicriteria.bot-zobrist-s2245.ruleKey", "scala:S2245")
property(
"sonar.issue.ignore.multicriteria.bot-zobrist-s2245.resourceKey",
"modules/bot/src/main/scala/de/nowchess/bot/util/ZobristHash.scala"
)
property("sonar.issue.ignore.multicriteria.bot-polyglot-s2245.ruleKey", "scala:S2245")
property(
"sonar.issue.ignore.multicriteria.bot-polyglot-s2245.resourceKey",
"modules/bot/src/main/scala/de/nowchess/bot/util/PolyglotBook.scala"
)
property(
"sonar.coverage.exclusions",
// UI renders JavaFX components; headless test environments cannot exercise rendering paths
@@ -120,6 +120,7 @@ final class PolyglotBook(path: String):
Move(from, to, MoveType.Normal())
/** Select a weighted random move from the list of book entries. */
@scala.annotation.nowarn("msg=scala:S2245")
private def weightedRandom(entries: Vector[BookEntry]): BookEntry =
if entries.length == 1 then entries.head
else
@@ -12,6 +12,7 @@ object ZobristHash:
private val pieceRands: Array[Long] = Array.ofDim(768)
// Side-to-move: XOR when Black to move
@scala.annotation.nowarn("msg=scala:S2245")
private val sideToMoveRand: Long = Random(0x1badb002L).nextLong()
// 4 entries: White kingside, White queenside, Black kingside, Black queenside
@@ -22,6 +23,7 @@ object ZobristHash:
// Initialize all random values using a seeded RNG for reproducibility
locally:
@scala.annotation.nowarn("msg=scala:S2245")
val rng = Random(0x1badb002L)
for i <- 0 until 768 do pieceRands(i) = rng.nextLong()
for i <- 0 until 4 do castlingRands(i) = rng.nextLong()