Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to trigger it:scalastyle? #64

Open
dvin-galstian opened this issue Sep 6, 2017 · 3 comments
Open

How to trigger it:scalastyle? #64

dvin-galstian opened this issue Sep 6, 2017 · 3 comments

Comments

@dvin-galstian
Copy link

The integration tests in our project are in the /src/it folder and the unit tests in src/test.

Although sbt test:scalastyle works fine and checks all the files in src/test, the command sbt it:scalastyle checks the source files in src/main.

Is there a way to configure the sbt scalastyle plugin to check the files in /src/it folder?

@kflorence
Copy link

+1

@kflorence
Copy link

kflorence commented Sep 29, 2017

EDIT: turns out you need to copy a little boilerplate from the plugin to get this to work (would be nice to expose this for easier use).

The following works for me:

val codeStyleIntegrationTest = taskKey[Unit]("enforce code style then integration test")

// and then in settings...
Project.inConfig(IntegrationTest)(ScalastylePlugin.rawScalastyleSettings()) ++
Seq(
  scalastyleConfig in IntegrationTest := (scalastyleConfig in scalastyle).value,
  scalastyleTarget in IntegrationTest := target.value / "scalastyle-it-results.xml",
  scalastyleFailOnError in IntegrationTest := (scalastyleFailOnError in scalastyle).value,
  (scalastyleFailOnWarning in IntegrationTest) := (scalastyleFailOnWarning in scalastyle).value,
  scalastyleSources in IntegrationTest := (unmanagedSourceDirectories in IntegrationTest).value,
  codeStyleIntegrationTest := scalastyle.in(IntegrationTest).toTask("").value,
  (test in IntegrationTest) := ((test in IntegrationTest) dependsOn codeStyleIntegrationTest).value
)

@e-kolpakov
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants