Suggesting future cleanups with matching rules for applied edits #661
Bennet-Sunder
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The goal is to suggest future cleanups after piranha cleanups are done, I understand we have an option to have matching rules but that runs on entire codebase but not the removed lines.
If we have code like so
piranha cleans up the code as such.
now
do_other_stuff
is removed as well. For all such removed code as part of tree sitter edit it'll be nice if we can run our matching rules on these deleted nodes so we can add suggestions likedo_other_stuff
is removed so they can check and remove the definition as well if there are no other references.For
Edit.new.is_delete()
I have managed to hack an implementation that runs a few rules to identify any future cleanups. It's easier for deletes as the entireedit
is removed. However for edit's like the above where there is a replacement would it be possible to identify deleted nodes by comparing the tree before and after applying the edit so that a few rules can be run to identify scope for future cleanups.Beta Was this translation helpful? Give feedback.
All reactions