mdedetrich opened a new pull request, #2: URL: https://github.com/apache/incubator-pekko/pull/2
There is a poll on how to approach this here https://github.com/mdedetrich/akka-apache-project/discussions/26. For original discussion please go to https://github.com/mdedetrich/akka-apache/pull/2 This PR updates and replaces scalafmt in the codebase since Akka happens to be using a really old version of .scalafmt and this is the best time to do it. Note due to the large number of changes that have happened in Scalafmt over time from what I can tell its essentially impossible to provide the exact same configuration that was in `2.1.0`. In addition to just updating and applying Scalafmt, the PR also adds a github action which on every PR checks that Akka is formatted. The github action uses scalafmt-native which is ultra fast and can format a codebase in seconds (for one that is the size of akka it should be ~1 minute). Since its a separate action it also runs concurrently to the main build. The PR also has been split into 3 commits with the `Apply scalafmt` commit containing all of the changes. This means if there is feedback for updating the scalafmt config its easy to rebase the PR with the updates. Below is a notable list of configurations/explanations. * With all of the different dialects of Scala that have come out, the new version of Scalafmt allows you to apply different dialects to different source directories using globs * New version of scalafmt applies newline breaks for implicits consistently where as the old scalafmt version did not. * New version of scalafmt adds a single space before every comment if there isn't already one. * Vertical align tokens have been added for `!`/`?` and `~>` since these are idiomatic operators. While `!` and `?` didn't have much effect in the codebase, `~>` is used in akka-stream custom graphs and greatly improves the readability of said graphs. * New version of scalafmt consistently removes paranthesis where as the old scalafmt version did not. * Formatting rules for hexcodes have been applied so they are consistent across codebase * Line endings are now enforced to be unix (removal of `line.endings = preserve` resets default to unix). This was changed at https://github.com/akka/akka/pull/31192 due to Windows line endings issues however since we are formatting entire codebase it shouldn't be a problem, @He-Pin can you confirm that this works under Windows? (i.e. if you run scalafmt on this branch in Windows that it doesn't mess with line endings). Note that almost all modern Windows editors/IDE's support Unix line endings (including Windows default notepad!) In general, the intention behind the updating of Scalafmt is to reduce the diff as much as possible while doing some easy wins (i.e. akka operators such as `!` and consistent hex code formatting). Another approach to updating scalafmt would essentially be YOLO and use more strict/consistent scalafmt options that the community agrees with. For example options such as `newlines.source = keep` and `newlines.beforeMultiline = keep` are there to minimize the diff as much as possible so if you remove them the codebase is more consistent however the diff ends up being much larger. If a lot of people agree that we don't care that much about keeping the current codebase and would prefer a more consistent code style I can remove the `newlines` options mentioned earlier. Since we are dealing with style formatting here, I would implore to avoid bikeshedding as much as possible, be reasonable in your feedback! This is the only chance we have of doing such a change since the idea is to do this immediately after Pekko gets approved into Apache incubator (if it does so). The PR is a draft currently since there is no intention of merging it yet. EDIT: Once the PR gets enough approvals we will add an ignore so that the formatting doesn't show up in git blame, see https://akrabat.com/ignoring-revisions-with-git-blame/. This will either be done in the same PR or in a following one. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
