-
Notifications
You must be signed in to change notification settings - Fork 161
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
After upgrade 5.41 -> 5.42 formatter adds additional \n between static and normal imports #500
Comments
Curious. There have been no changes in the formatter for some releases, so no idea what has triggered this. Now the bad bit: the formatter was a contribution, so I don't know the code well, nor TBH do I have much interest in it. So the chances of this getting fixed by me aren't high. Sorry. |
I took a look at the source code since this is a rather annoying issue. I hope I can offer a bit more context and a workaround with this comment. I am using the following rule in my checkstyle configuration (by default this is actually part of the google_checks.xml):
Upon importing this checkstyle configuration in IntelliJ the formatter creates the following
However, after closing and reopening the IntelliJ settings the
This is exactly the behavior mentioned by @DorianOlympia. I did not look into the actual reason why this is happening, but as a workaround it is possible to remove
Looking into the checkstyle documentation for CustomImportOrder this actually makes sense, due to the default value of
|
Thanks @dominicboeck - lovely work! I've made a change so that THIRD_PARTY_PACKAGE/SPECIAL_IMPORTS will be ignored if thirdPartyPackageRegExp/specialImportsRegExp are undefined, which I believe should avoid this nastiness. |
After upgrade 5.41 -> 5.42 formatter adds two \n between static and normal imports (according to xml checkstyle i should be once):
is refactored to:
even though according to checkstyle xml it should be:
This leads to inconsistency between checkstyle and formatter rules.
The text was updated successfully, but these errors were encountered: