-
Notifications
You must be signed in to change notification settings - Fork 276
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
SortModifiers does not follow Scala style guide #3788
Comments
feel free to modify the parameters of this rule the way you prefer. we can't change the default as that will likely affect too many existing users. |
I think it would be good idea to add note to documentation that the current default does not follow scala style guide and how to set it so that it will follow it. Is this something that you would accept PR for? And maybe this could be changed in next major version? |
@kitbellew That is why I have open this issue. We have already modify the order in our project by overriding the rule. rewrite.sortModifiers.order = [
sealed
abstract
override
private
protected
implicit
final
lazy
open
transparent
inline
infix
opaque
] The thing is that the Scala Style Guide does not cover all the modifiers while talking about the order of them (from the Scala 3 Reference)
I think the core of the discussion in this issue should be to clarify if there is an actual agreement of the order of all the modifiers. This issue already bring the attention to the fact that there is a slight divergence among the Style Guide and the defaults. From my point of view, a warning should be added in the documentation that the defaults do not follow the Scala Style Guide. What do you think? In the meantime, we can reach to the Scala Style Guide writers and ask them for a comprehensive order for the modifiers. |
The Scala Style Guide suggest the following:
Is the current sorting of the modifiers correct and the Scala Style Guide is outdated or is it the other way around?
Configuration (required)
Command-line parameters (required)
When I run scalafmt via CLI like this:
scalafmtAll
Steps
Given code like this:
Problem
Scalafmt formats code like this:
Expectation
I would like the formatted output to look like this:
The text was updated successfully, but these errors were encountered: