-
Notifications
You must be signed in to change notification settings - Fork 276
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
Non idempotent formatting #192
Comments
Here's a non-idempotent situation not involving an interpolated string. class A {
def traced(in: A => Unit, out: B => Unit): Fun[A, B] = ( f
. mapIn[A] { x => in(x) ; x }
. mapOut[B] { x => out(x) ; x }
)
} becomes class A {
def traced(in: A => Unit, out: B => Unit): Fun[A, B] = (f
.mapIn[A] { x =>
in(x); x
}
.mapOut[B] { x =>
out(x); x
})
} which becomes class A {
def traced(in: A => Unit, out: B => Unit): Fun[A, B] =
(f.mapIn[A] { x =>
in(x); x
}
.mapOut[B] { x =>
out(x); x
})
} Also, it was a lot better before anything happened to it. And in the "watch out for the future" department, those leading dots are only necessary through 2.10. In 2.11 and beyond that can be written def traced(in: A => Unit, out: B => Unit): Fun[A, B] = ( f
mapIn[A] { x => in(x) ; x }
mapOut[B] { x => out(x) ; x }
) I think dotless syntax is far superior for readability but I doubt most people can handle it unless their formatter does all the handling of it, hint hint. |
Thanks for the example!
Some auto migration tool would be nice, indeed. I'm not sure about baking it with scalafmt, I think it better belongs to another tool like scala-tidy, similar to clang-tidy. |
See
Reformatting again produces:
in commit olafurpg@779c1ee?diff=unified#diff-b276550f97eeb5bceb770dc3d64811ceL19
The text was updated successfully, but these errors were encountered: