File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
lib/src/lints/avoid_using_api Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 11## 0.4.0
22
33- Added ` allow_with_comments ` parameter for ` no_empty_block ` lint.
4-
4+ - Fixed an issue with ` avoid_using_api ` for extensions
55## 0.3.0
66
77- Added ` exclude ` parameter for the following lints:
Original file line number Diff line number Diff line change @@ -245,5 +245,30 @@ class AvoidUsingApiLinter {
245245 );
246246 }
247247 });
248+
249+ context.registry.addMethodInvocation ((node) {
250+ final methodName = node.methodName.name;
251+ if (methodName != identifier) {
252+ return ;
253+ }
254+
255+ final element = node.methodName.staticElement;
256+ if (element == null || element.enclosingElement3 is ! ExtensionElement ) {
257+ return ;
258+ }
259+
260+ final extensionElement = element.enclosingElement3! as ExtensionElement ;
261+
262+ if (extensionElement.name != className) {
263+ return ;
264+ }
265+
266+ final sourcePath = extensionElement.librarySource.uri.toString ();
267+ if (! _matchesSource (sourcePath, source)) {
268+ return ;
269+ }
270+
271+ reporter.atNode (node.methodName, entryCode);
272+ });
248273 }
249274}
You can’t perform that action at this time.
0 commit comments