Spotless with Eclipse format file: Method start brackets on new line

2 days ago 6
ARTICLE AD BOX

https://github.com/diffplug/spotless/tree/main/plugin-maven#java

I have configured Spotless Maven Plugin. In the past I have used Google Style eclipse format and changed indentation to 4 and line length to 100.

Now Using <palantirFormat> gives me that without having to supply an eclipse XML file into each git repository.

However there are two things I wish to change though.

I like 4 spaces indentation, but I also want 4 spaces continuation indentation, but both Google and Palantir uses 8 spaces

public Producer getProducer(int number) { final producers = producerService .findProdusers(number) .orElseThrow(() -> new RuntimeException()); return producer; } public Producer getProducer(int number) { final producers = producerService .findProdusers(number) .orElseThrow(() -> new RuntimeException()); return producer; }

This I can do with using an Eclipse XML formatter file.

The next thing I cannot find a solution for. With methods with many parameters I have come to like placing the method end paranthesis and start brackets on a new line.

public ResponseEntity<Producer> getProducer( @RequestParam final Integer name, @RequestParam final LocalDateTime date ) { }

Is there any way to allow this type of formatting with Spotless and Eclipse XML file?

But it must also allow this

public ResponseEntity<Producer> getProducer(@RequestParam final Integer name) { }

With IntelliJ formatter it never puts the ) { up if it is placed alone on a new line. But using the IntelliJ Idea formatter with Spotless is super slow.

Read Entire Article