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

False positive for one_member_abstracts #57701

Closed
lexaknyazev opened this issue May 2, 2018 · 3 comments
Closed

False positive for one_member_abstracts #57701

lexaknyazev opened this issue May 2, 2018 · 3 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-false-positive type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@lexaknyazev
Copy link
Contributor

Docs say:

Avoid defining a one-member abstract class when a simple function will do.

I don't think there's a way of avoiding one-member abstracts when they are used as "interfaces" like this:

abstract class Fooable { // one_member_abstracts 
  void foo();
}

void main() {
  Object o;
  if (o is Fooable) {
    o.foo();
  }
}
@pq
Copy link
Member

pq commented May 2, 2018

/cc @munificent

@munificent
Copy link
Member

Yeah, I'm not surprised there are false positives. It is an "AVOID" and not a "DON'T" rule, after all.

@pq pq added linter-false-positive type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Jun 27, 2018
@pq
Copy link
Member

pq commented Mar 13, 2020

I think this is working as intended and a case where a judicious //ignore is the right solution. (Ideally with a doc comment.)

@pq pq closed this as completed Mar 13, 2020
@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-false-positive type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

4 participants