Skip to content

consider new lint: use_logical_or #58861

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

Open
pq opened this issue Sep 8, 2022 · 0 comments
Open

consider new lint: use_logical_or #58861

pq opened this issue Sep 8, 2022 · 0 comments
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-new-language-feature linter-status-pending P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug

Comments

@pq
Copy link
Member

pq commented Sep 8, 2022

We might consider a lint to encourage the use of a logical-or rather than the equivalent empty case logic.

BAD

switch (shape) {
  case Square():
  case Circle():
    print('Symmetric shape');
  default:
    print('Asymmetric shape');
}

GOOD

switch (shape) {
  case Square() | Circle():
    print('Symmetric shape');
  default:
    print('Asymmetric shape');
}

/cc @munificent @bwilkerson

@pq pq added linter-new-language-feature linter-lint-proposal linter-status-pending P2 A bug or feature request we're likely to work on labels Sep 8, 2022
@srawlins srawlins added the type-enhancement A request for a change that isn't a bug label Mar 27, 2024
@devoncarew devoncarew added devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. labels Nov 19, 2024
@devoncarew devoncarew transferred this issue from dart-archive/linter Nov 19, 2024
@bwilkerson bwilkerson added area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. and removed legacy-area-analyzer Use area-devexp instead. labels Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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-new-language-feature linter-status-pending P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants