play framework and wartremover: warnings for *.scala.html files

303 views Asked by At

I finally got rid of the Wartremover warnings for routes with this line in the build.sbt:

wartremoverExcluded ++= routes.in(Compile).value

How can I achieve the same for the *.scala.html files? To exclude by directory does not seem to work, including

wartremoverExcluded += baseDirectory.value / "templates" 

does not seem to have any effect at all

I'm using play-framework 2.6.11 and sbt-wartremover 2.2.1 and sbt 1.0.3

1

There are 1 answers

0
crater2150 On

The templates are not directly handled by the compiler, Twirl generates pure scala sources from them first. You have to exclude the folder, where those generated sources are put. But Twirl doesn't use the sourceManaged folder (which I tried first), but has its own configuration key for that:

import play.twirl.sbt.Import.TwirlKeys    
wartremoverExcluded += (target in TwirlKeys.compileTemplates).value