static0886
static0886

Reputation: 784

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 what I did:

1- add the following to plugins.sbt

addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.3.1")

resolvers += "sonatype-releases" at "https://oss.sonatype.org/content/repositories/releases/"

2- add the following line in build.sbt

org.scalastyle.sbt.ScalastylePlugin.Settings

3- add the file scalastyle-config.xml to the root directory of the project.

So now when I go to the sbt console, I can run "scalastyle" and I get the output file "scalastyle-result.xml" in ./target.

BUT the file only contains this:

<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="5.0"></checkstyle>

So basically it is not raising any warnings. Now no need to mention that I do have a few classes in my project. But I am unable to distinguish whether the results xml is valid or not. I assume there should at least be a few warnings.

I've previously done some work with checkstyle which is quite similar, and in the ant target I got to specify the directory that checkstyle should be looking into. Is it similar with scalastyle?

Thanks a lot for the help.

Upvotes: 2

Views: 1136

Answers (1)

kap
kap

Reputation: 1804

The output of scalastyle is stored in multiple locations.

There is a file target/scalastyle-result.xml in the root directory containing the results of root-code. This can be empty, or better, it only contains the headers but no warnings/issues.

However, when there is also code in another directory (app in your example), then the output will be stored in the target of this directory as app/target/scalastyle-result.xml.

Upvotes: 0

Related Questions