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
upgrade scalafmt to 3.8.1 #2216
Conversation
We can try your suggestion. Also I don't know why it starts indenting with 4 characters, would be nice to change back to 2 to reduce the changes 🤔 |
I have a feeling this will probably cause an extremely large number of changes. Maybe there is something in the config we can do to make the current scalafmt look more like before? without removing |
Actually I think it's still 2, it's just that in most of those cases it added 2 to the line above, so the nested ones look like now they have 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should add a .git-blame-ignore-revs
file (see this post). Although, since we squash merge, I don't know whether it needs to be done manually in another PR or not 🤔
@@ -1,5 +1,5 @@ | |||
sys.props.get("plugin.version") match { | |||
case Some(x) => addSbtPlugin("com.github.ghostdogpr" % "caliban-codegen-sbt" % x) | |||
case _ => sys.error("""|The system property 'plugin.version' is not defined. | |||
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin) | |||
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is also quite bad for readability :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my experience, fixing the "ugly" cases like this is best done manually. For instance
case _ =>
val msg = """..."""
sys.error(msg)
Hmm I think in this case it might be a bug. It seems that it thinks the code in the parenthesis (starting with |
I pushed a commit with the proposed change now. Have a look and see if you like it, I much prefer it this way. In particular it's a plus that the examples no longer have long
yes, It'll be easiest to add this file in a commit after the fact |
I see codegen tests must be updated as well, likely because they pick up the new scalafmt via would you like to convert those to snapshot tests where we write to and compare contents in files instead, so we don't have to update these long strings manually? for local development we would always overwrite and then check into git, while in CI we can assert that the files be up to date. |
It may be a matter of personal taste (and mostly habit) but I absolutely hate non-aligned for comprehensions 🤣 I find it extremely hard to parse. |
Yeah, why not. We had issues before because those strings were too long and had to find some tricky workarounds. |
I'll leave that decision to you, and will back out that last commit if you want it like it was 👍 It's rather confusing by the way that there is a scalafmt version declared in build.sbt and one in |
The version in build.sbt is because the codegen depends on it for formatting the generated code, while |
Ok, dropped that commit |
That makes sense. I'm wondering if scalafmt 3.8.0 reads |
Does changing https://scalameta.org/scalafmt/docs/configuration.html#alignininterpolation to true make things better? |
no:
|
I'm okay with merging this (actually not all changes are bad, some are good) after solving the test failures. |
Sorry about the delay, I ran out of time for this. Pushed a commit with snapshot tests now, so hopefully we have a green build. I'll quote the commit message for some details:
It looks like circleci already sets the
|
b7588b6
to
cbedb14
Compare
omg CI's green 😃 |
both scalafmt and my head struggle with these
I rebased this this morning, so it should be good to go @ghostdogpr |
#2215 won't build until there is a newer scalafmt, because of some quote/splice syntax.
I think most of the changes are for the worse - would you be willing to remove the
align.preset = most
from.scalafmt
?If you think it's a good idea I'll push a new PR with a commit doing just that.