-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelinter-lint-proposaltype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
Description
Inspired by #60008.
If you have the following code:
void f(bool c) {
if (c) {
// do something
return;
} else {
// do something else
}
}The above // do something else does not need to be inside an else { ... } block.
I'm suggesting a lint that would detect this (leaving the function on earlier branches) and suggest removing the block since that could help with indentation for big lines that come after this point. Something like unnecessary_else_block.
// CC @pq
Metadata
Metadata
Assignees
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelinter-lint-proposaltype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug