scalastyle / scalastyle-sbt-plugin

scalastyle-sbt-plugin
Apache License 2.0
139 stars 52 forks source link

Unable to override scalastyleConfig in Test for subprojects #31

Closed gshakhn closed 9 years ago

gshakhn commented 10 years ago

Thanks for the recent 0.6.0 update! I'm now trying to run scalastyle on my test sources, which need maintenance too. I'd like a slightly different configuration for it, so I tried overriding scalastyleConfig in Test. This works for the root project, but doesn't seem to take for sub projects. Running show test:scalastyleConfig shows that the sub projects are using the default config.

The example is here: https://github.com/gshakhn/private-wiki/tree/test-scalastyle

Let me know if I can provide more detail.

DomBlack commented 10 years ago

For 0.6.0 I ended up with this in my config

  org.scalastyle.sbt.ScalastylePlugin.projectSettings ++
  Seq(
    org.scalastyle.sbt.ScalastylePlugin.scalastyleConfig in Compile := file("project/scalastyle-config.xml"),
    org.scalastyle.sbt.ScalastylePlugin.scalastyleConfig in Test := file("project/scalastyle-config.xml")
  )

And test:scalastyle still doesn't work, but scalastyle does.

matthewfarwell commented 9 years ago

Should be fixed by https://github.com/scalastyle/scalastyle.github.com/issues/3

zzztimbo commented 9 years ago

Has this bug really been fixed? I'm on 0.7.0 and see the same issue.

valeriakononenko commented 8 years ago

the same issue in 0.8.0

  .settings(
    scalastyleConfig in Compile := baseDirectory.value / "project" / "scalastyle-config.xml",
    scalastyleConfig in Test := baseDirectory.value / "project" / "scalastyle-config.xml"
  )
> sbt scalastyle
[info] Loading project definition from /path/to/my/Project/project
[info] Set current project to kafka.pipeline (in build file:/path/to/my/Project)
[info] scalastyle using config /path/to/my/Project/project/scalastyle-config.xml
[info] Processed 4 file(s)
[info] Found 0 errors
[info] Found 0 warnings
[info] Found 0 infos
[info] Finished in 8 ms
[success] created output: /path/to/my/Project/target
[success] Total time: 1 s, completed May 30, 2016 1:29:34 PM
> sbt test:scalastyle
[info] Loading project definition from /path/to/my/Project/project
[info] Set current project to kafka.pipeline (in build file:/path/to/my/Project/)
[info] scalastyle using config /path/to/my/Project/scalastyle-config.xml
java.lang.RuntimeException: config does not exist: scalastyle-config.xml
        at scala.sys.package$.error(package.scala:27)
        at org.scalastyle.sbt.Tasks$.doScalastyle(Plugin.scala:197)
        at org.scalastyle.sbt.ScalastylePlugin$$anonfun$rawScalastyleSettings$1$$anonfun$apply$1$$anonfun$apply$2.apply(Plugin.scala:89)
        at org.scalastyle.sbt.ScalastylePlugin$$anonfun$rawScalastyleSettings$1$$anonfun$apply$1$$anonfun$apply$2.apply(Plugin.scala:77)
        at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
        at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
        at sbt.std.Transform$$anon$4.work(System.scala:63)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
        at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
        at sbt.Execute.work(Execute.scala:235)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
        at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
        at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
[error] (test:scalastyle) config does not exist: scalastyle-config.xml
[error] Total time: 0 s, completed May 30, 2016 1:31:16 PM
edmondop commented 8 years ago

+1

raulsaeztapia commented 8 years ago

+1 Version 0.8.0