-
Notifications
You must be signed in to change notification settings - Fork 467
Add support for "Number Of Imports Needed Imports for .*" #17
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
Comments
It's definitely possible! It's not a priority for me, but I'd be happy to merge a PR, and to help along the way. For code formatting, we use the actual jars from Eclipse. For import sorting, we have a knockoff that can read Eclipse's import files, but it doesn't support all of their functionality. ImportSorterStep is what reads the user's input, and ImportSorterImpl is what does the actual import sorting. The impl part is copied from https://github.com/krasa/EclipseCodeFormatter. It looks like they've made a lot of progress since we last incorporated their work. If you (or anyone else) is interested in digging into this, I'd be happy to offer help here or in the gitter channel. |
I just dug into this a little, and krasa/EclipseCodeFormatter hasn't implemented this. If we wanted to use the Eclipse implementation, the key code is this: |
Well I finally got to fork the project. See what I can do over the next couple of weeks |
Great, thanks! Just as a heads-up, I'll be updating Spotless to Eclipse Neon and Gradle 2.14 around late June, as well as adding support for .gitattributes. This won't affect any Spotless API's, and I highly doubt that the Eclipse Neon API will be much different than the Mars API, so we shouldn't have any conflicts. |
It's not super high on our priority list, but.... the JUnit 5 team would certainly appreciate seeing this support implemented in Spotless. 😉 |
One year without progress. Also, |
😞 |
Has there been any improvements to enforce the googleJavaFormat of banning wildcard imports?
|
There isn't and there probably won't be. For example: import pkgA.*;
import pkgB.*;
public class Test {
AmIFromAorB field;
} When you organize imports in eclipse, the IDE knows whether |
I don't mean spotless should change it, but allow to fail if wildcard imports are used.
|
Ahh. I am not aware of anyone currently working on the issue, but the issue you want to watch is probably #167 |
Google Java Format doesn't handle this apparently (google/google-java-format#113), so it would be nice to have here. Doesn't seem easy though. |
More of a feature request if it does not already exist in the tool.
Is it possible to apply the "Number Of Imports Needed Imports for .*" preference when organizing imports?
The text was updated successfully, but these errors were encountered: