-
Notifications
You must be signed in to change notification settings - Fork 130
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
How do I search for all else {} blocks that contain a return or a throw? #17
Comments
Thanks for trying weggli out. A query like Please note the use of the --cpp flag to enable C++ support and the requirement to use ';' behind statements to make the query syntax valid (as in C/C++). Hope that helps :) |
Thank you @felixwilhelm - it works great! |
Now, for bonus points, is it possible to search for the same pattern, unless it is in a chain for if {} else if {} else if {} ? So, I still want to find these:
but not these:
Thank you again! |
Also, for double bonus points, is it possible to only report when the last else {} contains a single statement only (either throw or return) ? So, I want to find these:
but not these:
I hope you will find these challenges as interesting as I found this tool so very useful for large scale review and refactoring. Thank you for designing it and for opening it up! |
First of all, thank you for sharing such a useful tool!
I am trying to find patterns in the code like this:
so they can be refactored to return early and reduce code indentation.
I have tried:
but nothing seems to work. Help!
Thank you.
The text was updated successfully, but these errors were encountered: