Questions tagged [scalastyle]

Scalastyle is a style checker for Scala.

Scalastyle examines your Scala code and indicates potential problems with it. If you have come across Checkstyle for Java, then you’ll have a good idea what scalastyle is. Except that it’s for Scala obviously.

For more information, see http://www.scalastyle.org/

51 questions
3
votes
1 answer

export Intellij Idea scala static analysis rules into a scalastyle_configuration file

I want to keep the predefined static analysis rules from Intellij Idea in a scalastyle_configuration file and run the check at prepush githook in order to enforce those rules across our team. Is there a standard way to do so ?
NetanelRabinowitz
  • 1,534
  • 2
  • 14
  • 26
3
votes
2 answers

make sbt build fail on scalastyle warnings

I'm enforcing scalastyle check to my code space, referring http://www.scalastyle.org/sbt.html. in build.sbt: // scalastyle check lazy val compileScalastyle = taskKey[Unit]("compileScalastyle") compileScalastyle :=…
keypoint
  • 2,268
  • 4
  • 31
  • 59
3
votes
1 answer

How to convert scalastyle-result.xml into readable report

I am working on setting up various analysis tool for scala project. One of them is checkstyle and I am using 'scalastyle' for that purpose. This plugin produces not easily readable scalastyle-result.xml as a result of running. Is there a way to…
Shurik Agulyansky
  • 2,607
  • 2
  • 34
  • 76
2
votes
1 answer

Intellij scalastyle check in multiple projects with

I am working in several scala projects with IntelliJ and the same scalastyle_config.xml in the root of the projects. Is it possible to have only one config (e.g. in VCS) and IntelliJ uses it from this location?
Markes
  • 153
  • 1
  • 7
2
votes
1 answer

excluding folder from scalastyle sbt plugin

All the other questions I've found on this topic are quite old. I am building a scala project with sbt and the scala-style plugin but I can't find a way to exclude a specific folder where I have some generated code. Is there a way to force the…
dau_sama
  • 4,247
  • 2
  • 23
  • 30
2
votes
0 answers

Allow underscore imports of companion object's items in Scalastyle

I'd like to make scalastyle to ignore underscore imports in case when it is companion object's fields that are being imported(it makes sense to me): class Item { import Item._ //scalastyle marks it as a warning } object Item { case object…
stanislav.chetvertkov
  • 1,620
  • 3
  • 13
  • 24
2
votes
2 answers

File line length exceeds 100 characters

I meet a problem when I compile spark version 1.3.1. When I compiled the original source codes provided by spark,it was OK. But when I added some source files into the mllib, it came up with errors,like: message=File line length exceeds 100…
Shifeng.Liu
  • 105
  • 2
  • 7
2
votes
0 answers

Is it possible to exclude sources from scalastyle with sbt?

I am using scalastyle with sbt and I would like to exclude some generated sources (e.g. generated by Slick schema generator). Is there any setting for that ?
csferi27
  • 83
  • 1
  • 6
2
votes
1 answer

scalastyle producing empty output

I've been working on adding scalastyle to my scala project to check for potential problems in the code. But I keep getting empty results in the scalastyle-result xml file. I've followed the steps from the scalastyle.org website. In summary here's…
static0886
  • 784
  • 9
  • 25
1
vote
0 answers

scalastyle during sbt compilation reports error twice for the same line

I have the following in my build.sbt for setting up scalastyle to run on compilation. It works except that it produces duplicate errors on the same line. lazy val scalaStyleOnCompileTask =…
Higher-Kinded Type
  • 1,964
  • 5
  • 27
  • 44
1
vote
2 answers

Scala: Convert procedural code to functional

I've written code similar to the one given below. It works as per the (bit confusing) requirements but something tells me it can be written differently in Scala using 'pattern matching' or something like that to make it look more functional. Any…
DilTeam
  • 2,551
  • 9
  • 42
  • 69
1
vote
2 answers

scalafmt: Getting meaningful error messages

I am using 'scalafmt' command to ensure that I've no formatting errors in my Scala code. It keeps failing with this error message: Looking for unformatted files... (98.35 %, 238 / 242) error: --test failed Those are the last two lines. There's no…
DilTeam
  • 2,551
  • 9
  • 42
  • 69
1
vote
1 answer

Simple composition of functions in Scala

I have a simplified version of my code. What would be clear, what I want conceptually: def heavyCalcMul: Int => Int = i => i * 2 def heavyCalcDiv: Int => Int = i => i / 2 def heavyCalcPls: Int => Int = i => i + 2 and I use it like this: val x =…
HoTicE
  • 573
  • 2
  • 13
1
vote
0 answers

Initiate soft reload of scalastyle_config.xml in IntelliJ

IntelliJ's Scala plugin comes with support for Scalastyle and provides this guidance: Scalastyle examines your Scala code and indicates potential problems with it. Place scalastyle_config.xml in the root/.idea or root/project directory. However,…
Cory Klein
  • 51,188
  • 43
  • 183
  • 243
1
vote
0 answers

CustomMessage tag content not being displayed in IntelliJ

I'm trying to use the RegexChecker, along with a custom error message, in IntelliJ. I've defined my check similarly to this in scalastyle_config.xml:
Cethy
  • 551
  • 6
  • 18