Commit 82a03b1
authored
build: enable -Xfatal-warnings for Scala 2 and -Werror for Scala 3 (#1109)
* build: enable -Xfatal-warnings for Scala 2 and -Werror for Scala 3
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
* fix: suppress warnings exposed by -Xfatal-warnings/-Werror
Remove unused classTag import in HttpMessage.scala.
Add -Wconf suppressions for structural type warning (Scala 2),
synchronized warning and override-deprecated warning (Scala 3).
* fix: resolve all compilation warnings for fatal-warnings build
- 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
* style: apply scalafmt after removing imports
* fix: fix docs module -Werror duplicate flag and add more -Wconf suppressions
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.
* fix: exclude fatal-warnings from http-scalafix-rules module
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.1 parent f0236b3 commit 82a03b1
25 files changed
Lines changed: 31 additions & 41 deletions
File tree
- http-core/src
- main/scala/org/apache/pekko/http
- impl
- settings
- util
- javadsl
- scaladsl
- model
- headers
- ws
- settings
- test/scala/org/apache/pekko
- http
- impl/engine/ws
- scaladsl/settings
- testkit
- http-marshallers-scala/http-spray-json/src/main/scala/org/apache/pekko/http/scaladsl/marshallers/sprayjson
- http-tests/src/multi-jvm/scala/org/apache/pekko/remote/testkit
- http/src/main/scala/org/apache/pekko/http
- javadsl/server
- scaladsl/server
- project
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
344 | | - | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
345 | 347 | | |
346 | 348 | | |
347 | 349 | | |
| |||
400 | 402 | | |
401 | 403 | | |
402 | 404 | | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | 405 | | |
409 | | - | |
| 406 | + | |
| 407 | + | |
410 | 408 | | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
411 | 412 | | |
412 | 413 | | |
413 | 414 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
100 | 99 | | |
101 | 100 | | |
102 | 101 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | 52 | | |
54 | 53 | | |
55 | 54 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| |||
0 commit comments