Hello, To answer a couple of points raised in the JPR #448, there are a couple of static analysis tools for Scala:
Scalastyle - http://www.scalastyle.org/ Linter - https://github.com/HairyFotr/linter Scalastyle does the same sort of job as Checkstyle does for Java - there are about 50 rules at the minute (http://www.scalastyle.org/rules-0.4.0.html). The rules include checks for line/file length, equals & hashCode implemented in the same class/object, correct headers on each file. For instance, one of the checks that was mentioned in the round-up was for use of a lower case L for long literals - there is a check for that: org.scalastyle.scalariform.UppercaseLChecker. There is an eclipse plugin, maven, sbt. For more information, I presented Scalastyle at Scala Days 2012, https://skillsmatter.com/skillscasts/3256-coding-with-style-the-scalastyle-style-checker. When I started Scalastyle, I looked at doing it as a compiler plugin, but there were a number of issues, including: - the lack of documentation for compiler plugins and the lack (at that time) of a stable API; - the speed issues associated with the compiler; - you don't have all of the necessary information in a compiler plugin [*] Knowing this, we use scalariform (https://github.com/mdr/scalariform) which just produces an AST of the code, containing just the text. This is a lot quicker than using a compiler plugin. I don't know too much about Linter, maybe someone else do a better job than me to explain it. Have fun, Matthew Farwell. [*] The first phase of the compiler doesn't contain the comments, they are stripped out, so we wouldn't be able to check the license header on a file is correct etc. It has also de-sugared the for comprehensions into flatMap/filter etc.So we couldn't have any rules with respect to them. This second point was one of the complaints that Paul Phillips had about the compiler, I think he mentioned it in one of his talks, or on Twitter. I do remember him complaining about how you couldn't reconstruct the source code from the AST. -- You received this message because you are subscribed to the Google Groups "Java Posse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/javaposse. For more options, visit https://groups.google.com/groups/opt_out.
