proposal: prefer_merging_statement
#59529
Labels
area-devexp
For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.
devexp-linter
Issues with the analyzer's support for the linter package
linter-lint-proposal
linter-status-pending
P3
A lower priority bug or feature request
type-enhancement
A request for a change that isn't a bug
prefer_merging_statements
Description
Prefer merging switch statements with identical bodies to improve code readability and reduce redundancy.
Details
Merging switch statements with identical bodies improves code readability and reduces redundancy.
Kind
This lint enforces style advice by promoting code readability and reducing redundancy through the merging of identical switch statement bodies.
Bad Examples
Good Examples
Discussion
Edit
This would complement
unreachable_switch_case
:The future quick-fixes could be the two above examples where the
case value3
is moved up removing the current duplicated code or for it to merge with the other statement using the||
operator.I believe if this is implemented it should be added to
Effective Dart
.Discussion checklist
The text was updated successfully, but these errors were encountered: