Comments (13)
One way we worked around this:
scalastyleSources in Compile <++= unmanagedSourceDirectories in Test,
This means that running sbt scalastyle
(no test:
) will also run scalastyle on the test folder.
from scalastyle-sbt-plugin.
Pinging @adrian-wang since this is related to #41.
Note that scalastyleSources
can be overriden for the Compile
configuration like this:
(scalastyleSources in Compile) <++= unmanagedSourceDirectories in Compile
But doing the same for the Test
configuration has no effect.
from scalastyle-sbt-plugin.
Hi @fthomas , did you use
(scalastyleSources in Test) <++= unmanagedSourceDirectories in Compile
or
(scalastyleSources in Test) <++= unmanagedSourceDirectories in Test
?
from scalastyle-sbt-plugin.
I tried all of
(scalastyleSources in Test) <++= unmanagedSourceDirectories in Compile,
(scalastyleSources in Test) <++= unmanagedSourceDirectories in Test,
(scalastyleSources in Test) <++= unmanagedSourceDirectories in (Test, compile),
(scalastyleSources in (Test, compile)) <++= unmanagedSourceDirectories in Compile,
(scalastyleSources in (Test, compile)) <++= unmanagedSourceDirectories in Test,
(scalastyleSources in (Test, compile)) <++= unmanagedSourceDirectories in (Test, compile),
(scalastyleSources in (Test, scalastyle)) <++= unmanagedSourceDirectories in Compile,
(scalastyleSources in (Test, scalastyle)) <++= unmanagedSourceDirectories in Test,
(scalastyleSources in (Test, scalastyle)) <++= unmanagedSourceDirectories in (Test, compile),
but none of those had the desired effect.
In the sbt console test:unmanagedSourceDirectories
outputs the directories that should be added to test:scalastyleSources
.
from scalastyle-sbt-plugin.
This is unreasonable...
from scalastyle-sbt-plugin.
Indeed. Is there anything I could do to "debug" this?
from scalastyle-sbt-plugin.
Scalastyle is now an AutoPlugin, which may have changed behaviour slightly. Could you recheck this and see if there is still a problem, using 0.9.0-SNAPSHOT please?
from scalastyle-sbt-plugin.
@matthewfarwell I tried 0.9.0-SNAPSHOT but scalastyleSources
still contains only one directory:
[info] * /home/frank/data/code/refined/modules/core/jvm/src/main/scala
from scalastyle-sbt-plugin.
I don't understand the problem. I can do the following (using 0.9.0-SNAPSHOT, but as far as I'm aware this behaviour hasn't changed).
Add two directories and single file to scalastyleSources:
build.sbt:
name := "single"
version := "0.1.0"
scalastyleSources in Compile := Seq(
baseDirectory.value / "extra" / "foo",
baseDirectory.value / "extra" / "bar",
baseDirectory.value / "extra" / "Top.scala")
Use master scalastyle:
project/plugins.sbt:
resolvers += "sonatype-releases" at "https://oss.sonatype.org/content/repositories/snapshots/"
addSbtPlugin("org.scalastyle" % "scalastyle-sbt-plugin" % "0.9.0-SNAPSHOT")
Make sure the files exist:
$ mkdir extra extra/foo extra/bar
$ touch extra/Top.scala extra/foo/Foo.scala extra/bar/Bar.scala
And scalastyle processes in the output:
$ sbt scalastyle
[info] Loading project definition from /home/mfarwell/code/scalastyle/test/single/project
[info] Set current project to single (in build file:/home/mfarwell/code/scalastyle/test/single/)
[info] scalastyle using config /home/mfarwell/code/scalastyle/test/single/scalastyle-config.xml
[info] scalastyle Processed 3 file(s) <-------- **** PROCESSED THREE FILES ***
[info] scalastyle Found 0 errors
[info] scalastyle Found 0 warnings
[info] scalastyle Found 0 infos
[info] scalastyle Finished in 4 ms
[success] created output: /home/mfarwell/code/scalastyle/test/single/target
[success] Total time: 0 s, completed Apr 23, 2017 8:35:52 AM
from scalastyle-sbt-plugin.
@fthomas @adrian-wang Could you see if the behaviour has changed between 0.8.0 and 0.9.0, and if not, please tell me what the problem is, if indeed there is one. Thanks.
from scalastyle-sbt-plugin.
@matthewfarwell The problem still exists in 0.9.0. scalastyleSources
still contains only one source directory
> coreJVM/scalastyleSources
[info] * /home/frank/data/code/refined/modules/core/jvm/src/main/scala
instead of all relevant source directories for this project:
> coreJVM/unmanagedSourceDirectories
[info] * /home/frank/data/code/refined/modules/core/jvm/src/main/scala-2.12
[info] * /home/frank/data/code/refined/modules/core/jvm/src/main/scala
[info] * /home/frank/data/code/refined/modules/core/jvm/src/main/java
[info] * /home/frank/data/code/refined/modules/core/shared/src/main/scala-2.12
[info] * /home/frank/data/code/refined/modules/core/shared/src/main/scala
Since all my sources are in /home/frank/data/code/refined/modules/core/shared/src/main/scala
, scalastyle doesn't check any files.
The problem is not that I cannot change scalastyleSources
to contain the same directories as unmanagedSourceDirectories
(because we've done this at least in cats, circe, and refined) but that scalastyleSources
should contain the same directories as unmanagedSourceDirectories
by default. In a typical JVM / JS cross project it shouldn't be required to change scalastyleSources
.
BTW, I had similar issues with other plugins:
from scalastyle-sbt-plugin.
Can you try this with the snapshot and see if it works please?
from scalastyle-sbt-plugin.
Just tried 0.10.0-SNAPSHOT and it picks up all my source directories. Thanks @matthewfarwell!
from scalastyle-sbt-plugin.
Related Issues (20)
- Setting (scalastyleConfig in Test) inside an AutoPlugin doesn't work HOT 8
- Incompatible with AutoPlugin HOT 1
- plugins.sbt in IntelliJ IDEA - plugin not found HOT 2
- generate scalastyle-reports.html from scalastyle-reports.xml HOT 3
- Array of magic numbers HOT 2
- scalastyleSources setting does not support individual files HOT 2
- Fail the build on warning HOT 3
- How to invoke scalastyle before testing?
- Next release? HOT 2
- Publish for sbt 1.0 HOT 2
- How to trigger it:scalastyle? HOT 3
- `scalaStyle` key no longer accessible from `ScalastylePlugin` object HOT 3
- How do I pass args to the Plugin? HOT 1
- Add a normal task with no arguments HOT 3
- non-zero exit code HOT 5
- Trailing commas lead to very confusing scalastyle errors HOT 2
- Fewer output messages
- ScalaStyle
- ImportOrderChecker grouping not working as expected
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scalastyle-sbt-plugin.