question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GoogleJavaFormat entry point does not sort imports or remove unused

See original GitHub issue

The current entry point in spotless/java/GoogleJavaFormat is the Formatter.formatSource method which lacks fixing of import order and removal of unused imports.

If the entry point was changed to Main.main, the googleJavaFormat() step would work as expected.

#28 would partly be solved - if one uses googleJavaFormat()

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
sormurascommented, Nov 2, 2016

Maybe, action item 1. can partly be resolved over at google-java-format – see referenced issue above. If it gets merged, the new entry point in Formatter can be used without doing too much classloader magic.

0reactions
243826commented, Jan 7, 2020

Thank you! It worked and note to myself to be a little more thorough 😃

On Mon, Jan 6, 2020 at 8:26 PM Ned Twigg notifications@github.com wrote:

I think the <importOrder></…> should be inside the <java>…</java> part. See this example https://github.com/diffplug/spotless/tree/master/plugin-maven#applying-to-java-source .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/diffplug/spotless/issues/48?email_source=notifications&email_token=AAUT3Q4CYN7TF7FSWWF7D2LQ4QAAPA5CNFSM4CU2WGSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIHUZCQ#issuecomment-571427978, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUT3Q6CMQMKMF5OF3AYDTDQ4QAAPANCNFSM4CU2WGSA .

Read more comments on GitHub >

github_iconTop Results From Across the Web

git - How to format code according to google java format
git-code-format-maven-plugin will sort imports (since version ... googleformatter-maven-plugin can optionally sort imports (not per default).
Read more >
Index (Google Java Format 1.7 API) - javadoc.io
Formats an input string (a Java compilation unit) and fixes imports. Formatter - Class in com.google.googlejavaformat.java. This is google-java-format, a ...
Read more >
pantsbuild.pants.contrib.googlejavaformat · PyPI
Pants is an Apache2 licensed build tool written in Python. The latest documentation can be found here. 1.10.x Stable Releases.
Read more >
Set up Eclipse | Android Open Source Project
Under Organize > Imports, import the file android.importorder . Remove trailing whitespaces. To force Eclipse to remove all trailing whitespace:.
Read more >
Changelog - isort
Fixed #1777: extend_skip is not honored wit a git submodule when skip_gitignore=true. ... Implemented #1645: Ability to reverse the import sorting order.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found