Questions tagged [scala-wartremover]

10 questions
62
votes
1 answer

Should I use the final modifier when declaring case classes?

According to scala-wartremover static analysis tool I have to put "final" in front of every case classes I create: error message says "case classes must be final". According to scapegoat (another static analysis tool for Scala) instead I shouldn't…
sscarduzio
  • 5,938
  • 5
  • 42
  • 54
6
votes
2 answers

Wartremover still reports warts in excluded Play routes file

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 ++=…
jqno
  • 15,133
  • 7
  • 57
  • 84
4
votes
1 answer

how to avoid inferred type containing nothing with scala wart?

using scala wart I get: def lastWithRecursion(input: Seq[Int]): Try[Int] = input match { case head :: Nil => Success(head) case _ :: tail => lastWithRecursion(tail) case _ => Failure(new NoSuchElementException("No such element"))…
Jas
  • 14,493
  • 27
  • 97
  • 148
2
votes
1 answer

Scala Async and Wartremover

I wanted to use scala-async. I also use Wartremover with [Return] enabled. (http://www.wartremover.org/doc/warts.html#return). Then I added some code to test it: async { val studentsCount = await(studentsDao.getStudents()) val…
Krzysztof Atłasik
  • 21,985
  • 6
  • 54
  • 76
2
votes
1 answer

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

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,…
Tilman Rossmy
  • 181
  • 2
  • 10
2
votes
0 answers

Scala WartRemover with java.io.Serializable

I just hit a nasty bug where I had, essentially, sealed trait T extends Product with Serializable case object O extends T val mistake = List("foo", "bar", O /* forgot O.toString */) So scala went ahead and inferred List[java.io.Serializable] for…
seanmcl
  • 9,740
  • 3
  • 39
  • 45
2
votes
2 answers

Throwaway values - what is the best practice in Scala?

WartRemover's NonUnitStatements requires that statements that aren't returning unit must have an assignment. OK, but sometimes we have to use annoying Java APIs that both mutate and return a value, and we don't actually hardly ever care about the…
bbarker
  • 11,636
  • 9
  • 38
  • 62
1
vote
2 answers

Is there a way to prevent usage of a specific function provided by a dependency?

My application has a compile dependency to a library A. There is a specific function in this library which I know that causes performance problems. But it is not deprecated and if you don't have this prior information you would think that it is safe…
fcs
  • 926
  • 1
  • 8
  • 14
1
vote
0 answers

Getting "null is disabled" warning for log messages with scala wart remover

Wart remover complains about log messages. Why does it complain? How to get rid of wart remover warnings for log messages? [wartremover:Null] null is disabled [warn] logger.error(e) [warn] ^
Gowrav
  • 627
  • 7
  • 22
1
vote
1 answer

How to resolve inferred type containing Serializable

Stumped on this one. Working with PlayJSON and their JsObject. Wart remover is marking the map call with a carrot(^) and saying at that line Inferred type containing Serializable. Code is functional and working but wondering more about why tool is…
Barry
  • 1,800
  • 2
  • 25
  • 46