-
Notifications
You must be signed in to change notification settings - Fork 458
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
Problems with SpecificFilesTest #528
Comments
Note that all of this was initially tried on Gradle 6.0.1. It didn't work then either. |
The stacktrace indicates that Gradle itself does not support Java 13. It's different to support compiling code for 13, vs running the build on 13.
This is expected. The Gradle test infrastructure uses the code under test, which is why you can leave out the version number within the test.
Spotless uses the default java source set, which is spotless/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/JavaExtension.java Lines 178 to 188 in c007dba
SummaryIt looks like you made a lone test project to replicate SpecificFilesTest, and somehow it's not doing in the project what it looks to be doing in the test, correct? One way to make your test more similar is to put the file at spotless/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/SpecificFilesTest.java Line 24 in c007dba
|
Thanks for the explanation on those. I'll file a ticket with Gradle to properly support Java 13, though it works in most other cases.
No. Well, sort of. For the last bullet, I used the same project we talked about in the other thread, but I replaced the It seems like the test only passing when the test input file is in a particular location is a bug in the test, but I'll play around with it. I don't think Spotless should assume the files it's linting are in a particular place when using |
I don't know what Gradle's policy is, but 13 is not an LTS release, and will reach EOL this March (in weeks!) when Java 14 comes out. In this new fast-JDK cadence, I would expect that most infrastructure projects will only invest in LTS releases. As you note, the inbetween releases mostly work, which is the point of releasing them so fast, but the tradeoff is that the entire ecosystem is probably not going to work on non-LTS releases. Happy to merge expanded test coverage for SpecificFilesTest :) |
I'm working on some changes to the tests, but I still think the last issue I mentioned is a bug. I understand that this isn't a core feature so the core maintainers might not fix it, but it does seem like the problem I encountered in the other issue (the last bullet under "summary of problem" above) is a bug with Spotless. Even if it's because my files are in unexpected places, that's definitely a case that When I'm finished, the PR I make for the tests will go to #529. |
Thanks! I'll keep this ticket updated if I figure anything out! |
See comments #529 (comment) to #529 (comment) in #529 TL;DR-- |
I have confirmed that using an absolute path in If @nedtwigg and I can come up with an acceptable solution for checking relative and absolute paths, I will implement it. So I'd like to leave this ticket open. |
How hard is it to turn your relative-path inputs into absolute paths? Is it easier than changing this project, its tests, and documentation? |
Ah! I wrote a response for this but apparently never hit the comment button! Yeah, that's a good point. It would definitely be easier to use absolute paths, it just seems to me like supporting both options would be the ideal behavior; being restricted to just absolute paths is unintuitive and it seems unlikely that I'm the only person this will trip up. You're right that it's not worth the time to implement this feature, though perhaps it would make sense be clearer in the documentation that this is the case. I do think It is strange to me that only running spotless on changed files/a small subset of files appears to be such an uncommon use case. It seems like a formatter that only has the option to run on all source files at once would be unusable in almost all cases of introducing style conventions to an existing system. In my experience, incremental style compliance is the way to go in such a case...the only alternative is a massive CL/PR that touches every single file in the code base and you just hope that the formatter got every edge case correct. Anyway, unless you feel it is going to clutter your GitHub, I'd like to leave this ticket open, label it as an enhancement, and maybe rename it to something like "Relative Paths for spotlessFiles". Or we could create a new one if it seems more appropriate. It'd be nice to do in case someone ever decides they want to tackle it (possibly myself), though I understand that allowing such cases frequently might make your issues page become harder to parse. Just let me know what you think! |
I'm gonna dupe this out in favor of #529 which I'll leave open for you, and for which I've changed to an enhancement for relative paths. |
Sounds good. Thanks! |
I realized that the ticket you linked is the tests ticket, which is not specifically about relative paths, after I responded. Can we reopen this ticket and redo the naming? |
FYI, |
If you are submitting a bug, please include the following:
Three things:
SpecificFilesTest
fails with IllegalArgumentException. See logstarget
field to the Spotless config to make it lint any files-PspotlessFiles=Test.java
does not lintTest.java
. See the output listed in this comment on another issue. This was attempted both on Java 8 and Java 13. Both produce the same result.3.27.1
MacOSX 10.15.3
gradlew spotless[Apply/Check] --stacktrace
No errors, which is unexpected. A lint error is expected see this comment
The text was updated successfully, but these errors were encountered: