build: enable -Xfatal-warnings for Scala 2 and -Werror for Scala 3#1109
Merged
Conversation
Motivation: Treating warnings as errors ensures that deprecated API usage and other code quality issues are caught at compile time rather than accumulating. Modification: Add -Xfatal-warnings to Scala 2 scalacOptions and -Werror to Scala 3 scalacOptions in Common.scala. Remove -Wconf:cat=deprecation:s for Scala 3 so deprecation warnings are not silenced. Exclude -Xfatal-warnings from Compile / doc scope to avoid doc generation failures. Result: All compiler warnings are now treated as errors, enforcing higher code quality. Tests: - CI will verify compilation References: None - build configuration improvement
Remove unused classTag import in HttpMessage.scala. Add -Wconf suppressions for structural type warning (Scala 2), synchronized warning and override-deprecated warning (Scala 3).
73cde27 to
dfc8a09
Compare
- Remove unused imports (classTag, postfixOps, implicitConversions, Failure/Success/Try) - Add -language:implicitConversions as compiler option - Remove unused expectError method from ConnectionPoolSettingsSpec - Add -Wconf suppressions for: structural types, shadowed names, parameterless method confusion, Unit-valued patterns, infer-Any, overloaded implicit conversions, getClass selection, deprecation, refutable extractors, type specialization, type erasure, unreachable cases, exhaustivity, and suspicious top-level calls
…essions Move -Xfatal-warnings in docs module to Scala 2 only to avoid duplicate -Werror flag in Scala 3. Add suppressions for unused import and dead-code warnings in test modules.
The scala.meta compiler plugin used by scalafix generates warnings (InlineInfoAttribute) that cannot be suppressed via -Wconf. Exclude -Xfatal-warnings and -Werror from this module's scalacOptions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Treating warnings as errors ensures that deprecated API usage and other code quality issues are caught at compile time rather than accumulating silently.
Modification
-Xfatal-warningsto Scala 2scalacOptionsinCommon.scala-Werrorto Scala 3scalacOptions-Wconf:cat=deprecation:sfor Scala 3 so deprecation warnings are no longer silenced-Xfatal-warningsfromCompile / docscope to avoid doc generation failuresResult
All compiler warnings are now treated as errors, enforcing higher code quality and catching deprecated API usage at compile time.
Tests
References
None — build configuration improvement