Skip to content

single line if-elses should either be unchanged or should have braces inserted #578

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

Closed
leiboldm opened this issue Jan 31, 2017 · 1 comment

Comments

@leiboldm
Copy link

For example, dartfmt currently formats these statements like so:

// unformatted
if (condition) print('true');
else print('false');

// after formatting
if (condition)
  print('true');
else
  print('false');

If you're going to remove the brevity of those two lines by expanding them into four, you might as well follow the style guide which says to use braces: https://www.dartlang.org/guides/language/effective-dart/style#do-use-curly-braces-for-all-flow-control-structures

@munificent
Copy link
Member

The formatter only formats your code, it doesn't make other syntax changes required to bring it into compliance with the style guide. For details, see here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants