-
Notifications
You must be signed in to change notification settings - Fork 279
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
RedundantBraces for val
/var
/type
cannot be configured after #3022
#3026
Comments
i think you assumed that this rule is fully configurable, but it's not. there are some constructs that will be rewritten if the rule is enabled, regardless of any other parameter. as to method bodies, this parameter should have applied to methods with parameters only, otherwise they look like variables, as you surmised. |
Well, it was configurable enough for the above up until #3022. Dropping the rule entirely would allow upgrading without a diff, but would not restore the ability to specify the style of preferring braces for multi-line definitions (wheter def or val), but removing otherwise clearly redundant braces. |
multi-line seems to be the key. perhaps what you need is: https://scalameta.org/scalafmt/docs/configuration.html#inserting-braces |
@kitbellew
successfully removed the diff on upgrading. |
glad you found what you were looking for. about 0: because the way |
Problem
The intention of the above configuration was to remove braces only in interpolations and single-line applications, however after #3022
val
/var
/type
defs braces are also modified - but without an option to disable it as fordef
defs.Expectation
Expected
rewrite.redundantBraces.methodBodies
to also affectval
/var
. Often the choice betweenval
&def
affects only performance, not semantics, so it's unexpected for braces to change when switching between them.Proposal
However,
methodBodies
option cannot logically affecttype
definitions. The solutions, in order of increasing complexity, could be:Simplistic: Rename
methodBodies
option todefinitions
. Deprecate & alias old name.Simple: Add
defnBodies
option alongsidemethodBodies
.Complex: Remodel option into an array similar to
danglingParentheses.exclude
:The text was updated successfully, but these errors were encountered: