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
Replace Scalariform with Scalafmt #790
Conversation
Warning: the content of the PureConfig website changed with this pull request. This may be intentional (as is the case when sbt-microsites is updated or some breaking change occurs) or may be an unexpected change in the library's behavior. Please check the logs of the |
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.
Thanks for doing this. The time has come.
I'm fine with the default formatting. I'd be fine increasing the max line length to 120, but feel free to leave it as is.
Please consider adding a step to the build process which ensures that the code is formatted before any compile takes place by calling scalafmtCheckAll
and scalafmtSbtCheck
.
Nice, I also prefer 120 :) I think @jcazevedo is ok with it too.
I believe we already check this in our CI indirectly - after we run all the steps (including compiling, which automatically formats files) we run This was originally intended to catch both bad formatting and outdated tut-generated files. Do you see value in having an explicit step prior to compilation that just checks formatting? While it can be clearer for users to know what went wrong, it would prevent them from seeing compilation errors in the first round (which are arguably more important). |
@ruippeixotog I'd forgotten we had the |
Warning: the content of the PureConfig website changed with this pull request. This may be intentional (as is the case when sbt-microsites is updated or some breaking change occurs) or may be an unexpected change in the library's behavior. Please check the logs of the |
I agree with providing more direct feedback to the user. My concern is on frustrating contributors by not notifying them of everything at the first chance - it's a bit annoying to have a build fail because of formatting issues, push a commit to fix it just to be notified later that a test is also failing or tut is not synced. We could have a parallel GitHub Actions job just for formatting, but it seems a bit overkill, since a job spins a full fledged Docker container (in this case three due to the matrix build). Anyway, I added this extra step. I'll assume most sensible people compile the project before submitting a PR :) |
Scalafmt is more modern, more popular and better maintained than Scalariform. Moreover it has integration with multiple editors and IDEs. In this PR we do the plugin change and reformat all files.
I don't have strong opinions about most style settings, but I prefer to stay as close as possible to scalafmt defaults, as they're likely closer to most other projects making the code base more approachable. Therefore, I intentionally did not try to make scalafmt behave the same as scalariform. I opted to change the defaults for
align
(despite not being default it's recognized by scalafmt to be easier for diffs) and formaxColumn
(no one needs 80 chars per line anymore and it actually makes code harder to read IMO). Let me know if you feel strongly for any of the other options :)The PR is split in two commits, in case you only care about the plugin change and not about all the reformatted code.