sbt-tpolecat icon indicating copy to clipboard operation
sbt-tpolecat copied to clipboard

Is it possible to disable the unused warnings for generated src code in `target/src_manged`?

Open Kalin-Rudnicki opened this issue 3 years ago • 9 comments

Kalin-Rudnicki avatar Oct 26 '22 19:10 Kalin-Rudnicki

Not the same, but in Scala 2.13 you can suppress warnings in a directory:

Compile / scalacOptions += "-Wconf:src=target/.*:silent" // suppress all warnings for autogenerated files

iRevive avatar Nov 14 '22 08:11 iRevive

@iRevive's suggestion is how I've seen most projects deal with this problem (see e.g. https://github.com/hmrc/transit-movements-guarantee-balance/blob/main/build.sbt#L45), but if your code generator uses a custom sbt configuration (i.e. not Compile or Test but e.g. Routes) you could potentially set options in that configuration instead.

DavidGregory084 avatar Feb 10 '23 10:02 DavidGregory084

I came to the repo specifically to find this info - maybe it should be added to the README?

ccarlile avatar Mar 07 '23 21:03 ccarlile

Is there a similar option for Scala 3?

hugo-vrijswijk avatar Jul 07 '23 09:07 hugo-vrijswijk

@hugo-vrijswijk The Compiler Options Lookup Table says that -Wconf is available in Scala 3.3.x, so it should be the same?

DavidGregory084 avatar Jul 07 '23 10:07 DavidGregory084

I think the syntax might be different, or it is unsupported:

[warn] Failed to parse `-Wconf` configuration: src=target/.*:silent
[warn] unknown filter: src

hugo-vrijswijk avatar Jul 07 '23 11:07 hugo-vrijswijk

Unfortunately it looks like the src filter for -Wconf is not yet supported on Scala 3.x.

DavidGregory084 avatar Jul 07 '23 12:07 DavidGregory084

fyi src filter is supported in scala 3.3.4 and 3.5.0: https://github.com/scala/scala3/pull/18783

lenguyenthanh avatar Aug 17 '24 16:08 lenguyenthanh