Skip to content
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

Flag Sink objects that are never closed #57281

Closed
filiph opened this issue Feb 16, 2016 · 2 comments
Closed

Flag Sink objects that are never closed #57281

filiph opened this issue Feb 16, 2016 · 2 comments
Labels
analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. linter-lint-request type-enhancement A request for a change that isn't a bug

Comments

@filiph
Copy link
Contributor

filiph commented Feb 16, 2016

class A {
  IOSink _sink;
  void init(filename) {
    _sink = new File(filename).openWrite();
  }
}

Here's another linter hint that's standard-lib-specific (something like C linter hints complaining about unsafe use of memcpy, malloc, etc.). Whenever there is a Sink object that is opened in scope but never called close() upon in that same scope, that's a pretty strong indication the developer forgot.

We could easily identify other similar classes that have to be closed (or unsubscribed from) when no longer in use.

@alexeieleusis
Copy link
Contributor

This should be fixed now dart-lang/linter#241
small related variant in dart-lang/linter#242 landing soon

@pq
Copy link
Member

pq commented Jun 29, 2016

Implemented in close_sinks. Thanks @alexeieleusis!

@pq pq closed this as completed Jun 29, 2016
@devoncarew devoncarew added analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. labels Nov 18, 2024
@devoncarew devoncarew transferred this issue from dart-lang/linter Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. linter-lint-request type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants