-
Notifications
You must be signed in to change notification settings - Fork 201
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
Issue with Rule #699
Comments
@rajeshchinnam I will get back to u in a day or two. I am busy with something urgent at work for next two days. |
sure @ketkarameya I will be waiting for your response one more scenario I have my method public String get(String requestNumberPrefix, String request) { with Rule |
@ketkarameya can you please let me know what could be the issue here when you get some time. |
@rajeshchinnam can you please make a demo repository with your code and whatever python script you have written? It will be easier to collaborate. For instance, in your above rule I would do something like :
^ Just try to match your ff-api in the python script (using piranha's python api) and follow this example |
Thanks @ketkarameya Please refer https://github.com/rajeshchinnam/piranha/blob/main/feature_flag_cleanup.py I can able to fix the rule and I am trying to fix another use case https://github.com/rajeshchinnam/piranha/tree/main/configurations eg: I want to remove the test method for the stale feature flags @test can you please suggest the rule |
you actually do not need to match the context. |
Please review my updated rule https://github.com/rajeshchinnam/piranha/blob/main/configurations/rules.toml remove_method_with_specific_line : is updating as when("true").thenReturn("false"); and my rule is https://github.com/rajeshchinnam/piranha/blob/main/configurations/rules.toml when i am testing this on play sitter its matching but running on piranha its not matching Please suggest |
I fixed it @ketkarameya |
Hi @danieltrt
I have below rule , which is working fine on tree sitter play ground
[[rules]]
name = "replace_boolean_parse_with_literal"
query = """
(
(if_statement
condition: (
parenthesized_expression
(method_invocation
object: (identifier) @object
name: (identifier) @name
arguments: (argument_list
(true)
)
) @method_invocation
)
) @if_statement
)
(#eq? @object "Boolean")
(#eq? @name "parseBoolean")
"""
replace_node = "parenthesized_expression"
replace = "true"
groups = ["replace_expression_with_boolean_literal"]
but when I am running on piranha
I am getting below error
pyo3_runtime.PanicException: Could not parse the query : "(\n\t(if_statement\n\t condition: (\n\t\tparenthesized_expression\n\t\t(method_invocation\n\t\t object: (identifier) @object\n\t\t name: (identifier) @name\n\t\t arguments: (argument_list\n\t\t\t(true)\n\t\t )\n\t\t) @method_invocation\n\t )\n\t) @if_statement\n)\n(#eq? @object "Boolean")\n(#eq? @name "parseBoolean")\n" Some(QueryError { row: 2, column: 3, offset: 20, message: "\t condition: (\n ^", kind: Structure })
any help on this is well appreciated
Thanks in advance
The text was updated successfully, but these errors were encountered: