tuxji commented on PR #947:
URL: https://github.com/apache/daffodil/pull/947#issuecomment-1414527871

   I have tried to find a canonical "standard Scala code style" scalafmt 
configuration without any success.  It looks like various projects have put 
together their own differing scalafmt configurations, often overriding many 
tens of parameters.  I don't even know how well scalafmt's default 
configuration matches "standard Scala code style", that is, I don't know how 
many scalafmt parameters we will need to override to actually match modern 
standard Scala code style.  Oh well....
   
   [Configuration | 
Scalafmt](https://scalameta.org/scalafmt/docs/configuration.html) documents the 
parameters (not very well, in my opinion) and shows their default values at the 
end of the page.
   
   [Installation | 
Scalafmt](https://scalameta.org/scalafmt/docs/installation.html) says that 
Intellij IDEA will detect a .scalafmt.conf file at the root of the project, 
prompt you, and if you agree, will use scalafmt instead of Intellij's own 
formatter when formatting files.
   
   [Gotchas | Scalafmt](https://scalameta.org/scalafmt/docs/gotchas.html) shows 
two situations where you can use newlines to avoid long lines without scalafmt 
overriding you even if maxColumn would force a longer line.
   
   [Declarations | Style 
Guide](https://docs.scala-lang.org/style/declarations.html) shows what I think 
is the most important change  scalafmt should make to match the standard Scala 
code style (put constructors all on one line unless too long, then put each arg 
on its own line with trailing commas).  I want to see trailing commas used 
everywhere args are put on their own lines since trailing commas on args makes 
formatting look consistent and makes changes to the args much easier.
   
   [DataBricks Scala Guide](https://github.com/databricks/scala-style-guide) 
has some different opinions than the standard Scala guide so I wouldn't follow 
everything it says, but some of what it says is worth reading.
   
   [[incubator-pekko-grpc] 01/09: Update 
scalafmt](https://www.mail-archive.com/[email protected]/msg00325.html) 
shows the first message of a 9-part pull request formatting a Scala project.  
It can serve as an example of how another project has done it.
   
   I agree with Mike that alignment shouldn't be turned on.  I would like to 
see pragmatic changes to Daffodil code, that is, changes should be configured 
to be minimal except for one-line args; if scalafmt can change the last 
one-line arg to have a trailing comma, I'd prefer that to be done everywhere.  
Thoughts?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to