Skip to content

Lint for empty catch blocks #57191

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
zoechi opened this issue Mar 7, 2015 · 3 comments
Closed

Lint for empty catch blocks #57191

zoechi opened this issue Mar 7, 2015 · 3 comments
Labels
devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. linter-lint-request type-enhancement A request for a change that isn't a bug

Comments

@zoechi
Copy link
Contributor

zoechi commented Mar 7, 2015

This is a code smell and would be great if the linter could inform about it.

@pq pq added type-enhancement A request for a change that isn't a bug linter-lint-request labels Mar 7, 2015
@pq
Copy link
Member

pq commented Mar 7, 2015

Would you want to treat the following equally?

try {
  ...
} catch(exception, stackTrace) {
  // ignore
}

vs.

try {
  ...
} catch(exception, stackTrace) { }

Maybe this is where linter-specific comments come into play:

try {
  ...
} catch(exception, stackTrace) {
  // dartlint:ignore:empty_catch
}

(Not a real comment format but you get the idea.)

@zoechi
Copy link
Contributor Author

zoechi commented Mar 9, 2015

I would require a linter comment to silent hints/warning like in your 3rd example

@pq
Copy link
Member

pq commented Mar 9, 2015

@zoechi 👍 #57193.

pq referenced this issue in dart-archive/linter Jul 27, 2016
* Grinder support (`rule:rule_name` and `docs:location`) for rule stub and doc generation (respectively).
* Fix to allow leading underscores in `non_constant_identifier_names`.
* New `valid_regexps` lint (#277).
* New `whitespace_around_ops` lint (#249).
* Fix to `overridden_fields` to flag overridden static fields (#274).
* New `list_remove_unrelated_type` to detect passing a non-`T` value to `List.remove()`` (#271).
* New `empty_catches` lint to catch empty catch blocks (#43).
* Fixed `close_sinks` false positive (#268).
* Added `linter` support for `--strong` to allow for running linter in strong mode.

BUG=
[email protected]

Review URL: https://codereview.chromium.org//2182183004 .
@devoncarew devoncarew added devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. labels Nov 18, 2024
@devoncarew devoncarew transferred this issue from dart-archive/linter Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. linter-lint-request type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants