I'm trying to add Wartremover to my Play project, but it keeps reporting warts on the routes file, even if I exclude it. I'm using Wartremover 0.14 and Play Framework 2.4.6.
The relevant part from my build.sbt:
wartremoverErrors ++= Warts.all
wartremoverExcluded += crossTarget.value / "routes" / "main" / "router" / "Routes.scala"
(Note that I have to do it differently than the answers in this question suggest.)
Without the wartremoverExcluded
line, Wartremover reports 13 errors in my routes file. With it, it still reports two: one about Wart.Var
and one about Wart.ExplicitImplicitTypes
. I can exclude these warts too, but using Warts.allBut(Wart.Var, Wart.ExplicitImplicitTypes)
, but I'd prefer not to, because that excludes these warts from my entire codebase, not just the routes file.
Is there a way to make Wartremover stop reporting these warts on the route file, without excluding these warts for every file?
Try adding these:
Edit: It's over a year since I first wrote this answer.
wartremoverExcluded
has been changed from aSettingKey
to aTaskKey
, so you can simplify the above to:For sbt 1.4+:
Or you could try this sbt plugin I wrote to do it for you.