- 
                Notifications
    
You must be signed in to change notification settings  - Fork 73
 
Update scalafmt-core to 3.8.6 #1413
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
base: main
Are you sure you want to change the base?
Update scalafmt-core to 3.8.6 #1413
Conversation
cf53b10    to
    d883083      
    Compare
  
    d883083    to
    56054f7      
    Compare
  
    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.
+1
-  Do all automated continuous integration checks pass?
Yes, rebased/squashed and rerunning -  Is the update a patch, minor, or major update?
Patch update, a number of small reformats but otherwise seems reasonable -  Is the license still compatible with ASF License Policy?
Yes, ALv2 -  Have any changes been made to LICENSE/NOTICE files that need to be incorporated?
Not applicable, we do not distribute -  Have any transitive dependencies been added or changed?
Not applicable, we do not distribute 
| case (_, v :: Nil) :: Nil => { // flag was present with a parameter, convert the parameter | ||
| case ( | ||
| _, | ||
| v :: Nil | ||
| ) :: Nil => { // flag was present with a parameter, convert the parameter | 
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.
Curious why some lines get expanded like this and others get compressed onto a single line.
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 can't really say. I imagine this has to do with long lines and splitting function parameters per line.
We really shouldn't disable scalafmt, so if we don't like these changes, we either need to find and modify a config option that changes it (not sure what that would be or if it would affect other places), open a bug with scalafmt if we think it's wrong, or rewrite it in some way that doesn't require this formatting. Of those, the last is probably the best option, but I'm not sure how much it's wroth it.
I generally let scalafmt do its thing for existing code and just focus on ensuring new code is formatted reasonably.
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 took a little look into changing some settings and I think adding
newlines.avoidForSimpleOverflow = [slc]
helps a bit as that will ignore trailing single line comments when determining if we should create a new line. Tried adjusting some settings for XML literals too, but that just made things worse. You can see what the changes would look like here:
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.
The avoidForSimpleOverflow=[slc] is definitely a reasonable improvement. Loosening line length restrictions in favor a readability is usually a win. That said, in most of the changes I would think just moving the comment to its own line is probably more readable, but I'm not sure it's worth the effort to fix.
| primType match { | ||
| case PrimType.Float | PrimType.Double | PrimType.Boolean | | ||
| PrimType.HexBinary => /* Non textual data, no need to compare alignment to encoding's expected alignment */ | ||
| case PrimType.Float | PrimType.Double | PrimType.Boolean | PrimType.HexBinary => /* Non textual data, no need to compare alignment to encoding's expected alignment */ | 
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 one got compressed onto a single line.
| case WholeExpression(_, LiteralExpression(500.0), _, _, _, _) => /* ok */ ; | ||
| case WholeExpression(_, LiteralExpression(500.0), _, _, _, _) => /* ok */ | ||
| ; | 
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.
Not really a fan of these changes, is it worth configuring this (if possible)?
| intercept[MalformedInputException] { // fails to convert because there is no possible surrogate-pair rep for this. | ||
| intercept[ | ||
| MalformedInputException | ||
| ] { // fails to convert because there is no possible surrogate-pair rep for this. | 
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 is just harder to read in my opinion
| val testSuite = <testSuite xmlns={tdml} suiteName="theSuiteName"> | ||
| val testSuite = <testSuite xmlns={ | ||
| tdml | ||
| } suiteName="theSuiteName"> | 
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 also seems harder to read.
56054f7    to
    3b0efcb      
    Compare
  
    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.
+1
I'm giving this a +1 with my change of adding
newlines.avoidForSimpleOverflow = [slc]
to the settings to ignore single line comments when determining line length for wrapping.
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.
-1
This change should not be merged. There are places where this changes the meaning and context of comments. This behavior of scalaFmt is a bug and needs fixing.
A line comment isn't necessarily about the last thing on the line. It is about the content
of the line, and adding things to the beginning of that line changes the context of the comment in ways that can break the intent.
| val le32BitData = Array[Byte](0x01, // BE MSBF | ||
| 0x43, 0x33, 0x33, | ||
| 0x32, // fourbyteswap + LE LSBF (parsed right to left four bytes at a time) | ||
| 0x43, 0x33, 0x33, 0x32, // fourbyteswap + LE LSBF (parsed right to left four bytes at a time) | 
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 kind of upward line recombining is problematic.
In this case, it's ok.
Had that comment been directed specifically at just the line with the 0x32 on it, then this move
would change the meaning of the comment.
If I write this:
class Foo(a1 : Int,
   a2: Float, // this argument needs some commentary
   a3: Double
) extends Bar
with Baz // for some purpose that requires a bit of explaining
It is unacceptable for it to be turned into:
class Foo(a1 : Int, a2: Float, // this argument needs some commentary
   a3: Double
) extends Bar with Baz // for some purpose that requires a bit of explaining.
Because that changes the meaning of the comments.
The context of a line comment is the contents of the line at the time the comment is written.
I think if a line has a line comment on that line, that line cannot be moved, or combined with other lines.
You can change the indentation, but you can't merge it upward onto a short line without changing the
context of the comment text.
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.
Ah, I missed that this got changed. 100% agree. I will revert back to the original scala-steward changes.
3b0efcb    to
    56054f7      
    Compare
  
    56054f7    to
    7f47808      
    Compare
  
    Executed command: scalafmt --non-interactive
7f47808    to
    2a6032a      
    Compare
  
    
About this PR
π¦ Updates org.scalameta:scalafmt-core from
3.8.3to3.8.6π GitHub Release Notes - Version Diff
Usage
β Please merge!
I'll automatically update this PR to resolve conflicts as long as you don't change it yourself.
If you'd like to skip this version, you can just close this PR. If you have any feedback, just mention me in the comments below.
Configure Scala Steward for your repository with a
.scala-steward.conffile.Have a fantastic day writing Scala!
β Adjust future updates
Add this to your
.scala-steward.conffile to ignore future updates of this dependency:Or, add this to slow down future updates of this dependency: