3 ms·
I have been looking for, but haven't found, a similar package for Java projects. Ideally my team can add it as a save-hook for everyone using IDEA, then we can
by ssutch3 7y ago
I have been looking for, but haven't found, a similar package for Java projects. Ideally my team can add it as a save-hook for everyone using IDEA, then we can have a pre-commit hook that checks to ensure compliance. Would be eternally grateful for anyone that can point me in the right direction!
- ljm 7y agoI've been using Spotless, which has been working well enough.
- dodobirdlord 7y agoI suggest https://github.com/google/google-java-format https://github.com/google/google-java-format
- davnicwil 7y agoI'm very happy using this, coming from prettier with JS/VSCode and looking for a similar dev experience in Java/Intellij - it has an IntelliJ plugin that works well. Last time I looked I couldn't find any good IntelliJ plugins for the Java implementation of prettier which was a dealbreaker - I need the format on save. Anyway, this is a great tool, just works. Only couple of issues it has is no 'ignore formatting for this piece of code' feature and it occasionally formats comments oddly (i.e. enough to make them unreadable) in certain edge cases like in ternary expressions, so you have to manually edit comments from time to time, but this hardly ever comes up.
- tomnipotent 7y ago> I need the format on save Check out Preferences -> Tools -> File Watchers.
- davnicwil 7y agoGreat shout! Didn't know about this feature but this solves the problem elegantly. Will give it a try.
- __initbrian__ 7y agoAt work, we use clang-format for java and c++. prettier for js, ts
- thorn0x 7y agoThere exists a Java plugin for Prettier: https://github.com/jhipster/prettier-java https://github.com/jhipster/prettier-java No idea how good it is though. Please tell us. :)
- lipis 7y agohttps://github.com/jhipster/prettier-java https://github.com/jhipster/prettier-java
- j-f1 7y agoThere’s https://github.com/jhipster/prettier-java https://github.com/jhipster/prettier-java, which expands Prettier to work with Java, but I’m not sure how complete or thoroughly-tested it is. It also requires that you have Node installed, which could be be a downside for people who only work with Java.