-
Notifications
You must be signed in to change notification settings - Fork 125
If statements test clause is wrapped. Probably better to add parentheses and wrap after. #182
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
Comments
I re-ran using dartformat instead of dartfmt. Now the output is transformed to:
|
This is as-designed. The formatter's charter is to only touch whitespace, so it doesn't add brackets or any other substantive changes like that. The linter that @pq is working on likely will handle this. |
I expect we'll have a bunch of lints along these lines down the road. Feel free to open a request so we can track this one. https://github.com/dart-lang/linter Thanks! |
Looks like you've got it already. Keep up the good work! |
:) Thanks! Feel free to chime in with more! |
The following:
Is transformed to:
This probably would be better as:
Though I agree this is matter of taste and people will disagree.
On a side note - In my own private style guide I often write 2 line if statements as in the top example. I am aware that this doesn't match the Dart style guide. But I'm ok with adding parentheses - just so I can leave formatting to the machines.
The text was updated successfully, but these errors were encountered: