uber / piranha

A tool for refactoring code related to feature flag APIs
Apache License 2.0
2.3k stars 199 forks source link

Treesitter not finding the method #697

Closed rajeshchinnam closed 1 month ago

rajeshchinnam commented 2 months ago

Hi Thanks in advance

I have below tree sitter query

remove_test_annotated_methods = Rule( name="remove_test_annotated_methods", query=""" (method_declaration (modifiers (marker_annotation name: (identifier) @annotation_name ) ) name: (identifier) @method_name body: (block) @method_body ) (#eq? @annotation_name "Test") """, replace_node="method_declaration", replace="", is_seed_rule=True )

and I want to find the method and remove

@Test void testMethod() { when(tenantConfiguration.get(TenantConfigurationKey.FEATURE_SEQUENTIAL_NUMBERS_FOR_WARRANTY)).thenReturn("false"); }

but this rule not working can you please tell me what could be the issue and how to debug