从WartRemover中排除play路由文件生成的代码

5

我正在一个play项目中使用WartRemover。我想要将routes文件(由其生成的代码)从Wartremover的扫描中排除。我添加了以下内容,但它仍然会扫描play生成的routes代码。

wartremoverExcluded ++= Seq("com.xxx.controllers.ReverseMyController","com.xxx.controllers.javascript.ReverseMyController","com.xxx.controllers.ref.ReverseMyController")

它仍然显示了“wart”错误,这些错误来自于生成的routes play文件。例如:

warn] /xxx/conf/routes:23: Inferred type containing Nothing
warn] PUT /service/myendpoint      com.xxx.controllers.MyController.postMyData

对于路由文件中定义的许多其他路由,同样适用。

如何从wartremover扫描中排除路由?


不确定这是否有太大帮助,但我注意到即使已经排除了路由文件,Wart.Nothing 似乎仍然会失败,而其他一些警告,如 Wart.AnyWart.ProductWart.Serializable 则表现正常。 - Klugscheißer
2个回答

0

看起来这个问题是在 wartremover 0.11 的情境下提出的,但如果有人在这里寻找 0.12 的解决方案,这对我有效:

wartremoverExcluded += sourceManaged.value / "main" / "routes_reverseRouting.scala"
wartremoverExcluded += sourceManaged.value / "main" / "routes_routing.scala"

0

你尝试过在scalacOptions中加入-Xprint:typer来查看哪个包出了问题吗?当我忽略以下内容时,它似乎对我有用。

wartremoverExcluded ++= Seq("Routes", "controllers.ref")

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接