jbang
jbang copied to clipboard
Modify/reformat source with some sane formatting
Is your feature request related to a problem? Please describe. I'm always frustrated when looking at the code 😄
Describe the solution you'd like Apply some "normal" code formatting, as this (failed by spotless and then "reformatted" by spotless) is insane: https://github.com/jbangdev/jbang/pull/1901/commits/d33f99de34112a20c83105bb8db573556b91e4f2
Describe alternatives you've considered Some modern and normal formatting, as 80 width is long past current screen estates.
Additional context This formatting https://github.com/jbangdev/jbang/pull/1901/commits/d33f99de34112a20c83105bb8db573556b91e4f2
vs this one (both are quite "fluent"): https://github.com/apache/maven/blob/master/impl/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultLifecycleRegistry.java
I agree, in general I never liked the fact that it will indent continued lines past the end of the first line. It pushes some lines way off to the right. I hope it's fixable, the Google format is notoriously difficult to configure IIRC.
JBang uses Eclipse formatter as I see, at least spotless config points at misc/eclipse_something.xml
In that case 👍
its 5 years since I last edited the formatting rules...I'm used to it now so I just edit code and let the formatter apply L)
but PRs welcome assume it makes things better and doesn't reformat the world completely :)
its 5 years since I last edited the formatting rules...I'm used to it now so I just edit code and let the formatter apply L)
https://github.com/google/google-java-format, perhaps?
but PRs welcome assume it makes things better and doesn't reformat the world completely :)
IMHO a one time bulk reformat everything is not the end of the world. There's also .git-blame-ignore-revs.
Take a look at the PR I just created: https://github.com/jbangdev/jbang/pull/1933
To me that's a lot better, but what do you think?
Edit: btw, this uses "default indentation" which still uses 2 tabs for each line, eg:
List<Dependency> mdeps = boms.stream()
.flatMap(d -> getManagedDependencies(strictSession, d).stream())
.collect(Collectors.toList());
but also
gb
.setArguments(userParams)
.runtimeOptions(runMixin.javaRuntimeOptions)
.mainClass(buildMixin.main)
.moduleName(buildMixin.module)
.debugString(runMixin.debugString)
.classDataSharing(runMixin.cds);
So not sure if we'd want to change that to the option that only indents with a single tab. Personally I only use a single indent in those cases, but not sure what others' preferences are.
hmm - I thought it was formatting with closest tab not fixed 2 tab indent?
btw. the pr does look better but not merging it just yet in case another tweak is found reformatting the world again ;)
hmm - I thought it was formatting with closest tab not fixed 2 tab indent?
Perhaps, but it would look at the next tab after the last char on the previous line. Which means that if that line was very long the following lines would be indented a ridiculous amount.
btw. the pr does look better but not merging it just yet in case another tweak is found reformatting the world again ;)
Sure. Btw, I don't think it was really that big of a change. Yes, it touches a pretty large amount of files, but surprisingly it doesn't change that many lines.