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

Using avoid_using_api for extension methods. #156

Open
gaetschwartz opened this issue Apr 4, 2024 · 2 comments
Open

Using avoid_using_api for extension methods. #156

gaetschwartz opened this issue Apr 4, 2024 · 2 comments

Comments

@gaetschwartz
Copy link

I want to prohobit the usage of Iterable<Future<T>>'s wait getter, but can't seem to find a way to match it. Here is the definition in dart:async:

extension FutureIterable<T> on Iterable<Future<T>> {
  Future<List<T>> get wait { /* ... */ }
}

I tried:

custom_lint:
  rules:
    - avoid_using_api:
      severity: info
      entries:
        - class_name: FutureIterable<T> // but also FutureIterable<dynamic, FutureIterable, Iterable, Iterable<Future>, Iterable<Future<dynamic>>, Iterable<Future<T>>
          identifier: wait
          source: dart:async
          reason: "Iterable.wait should be avoided because it loses type
            safety for the results. Use a Record's `wait` method
            instead."
          severity: warning

but to no success. Without specifiying the class_name works but does match the (f1,f2).wait getter method I don't want to match.

@illia-romanenko
Copy link
Collaborator

@getBoolean have you tried anything like that?

@getBoolean
Copy link
Contributor

I haven't tested against extension methods, it might not be handled properly by the current implementation. I'll look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants