From c231feca50c91ca31ebe1394827d6d39a3af6c07 Mon Sep 17 00:00:00 2001 From: clavedeluna Date: Tue, 2 Jan 2024 17:04:23 -0300 Subject: [PATCH] add filter --- src/core_codemods/remove_module_global.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core_codemods/remove_module_global.py b/src/core_codemods/remove_module_global.py index e320c436..8bbe67b5 100644 --- a/src/core_codemods/remove_module_global.py +++ b/src/core_codemods/remove_module_global.py @@ -15,6 +15,10 @@ class RemoveModuleGlobal(BaseCodemod, NameResolutionMixin): def leave_Global( self, original_node: cst.Global, _ ) -> Union[cst.Global, cst.RemovalSentinel,]: + if not self.filter_by_path_includes_or_excludes( + self.node_position(original_node) + ): + return original_node scope = self.get_metadata(ScopeProvider, original_node) if isinstance(scope, GlobalScope): self.report_change(original_node)