-
Notifications
You must be signed in to change notification settings - Fork 185
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
Start a fuzzing suite to test for consistency of lints #2818
base: main
Are you sure you want to change the base?
Conversation
@DavisVaughan / @lionel-, I'm curious if any of your recent work on {air}/{treesitter.r} & friends could be re-used here. The idea is we want to make random injections/edits to the R AST (and then do stuff), my approach here felt quite manual/labor-intensive. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2818 +/- ##
=======================================
Coverage 99.64% 99.64%
=======================================
Files 126 126
Lines 6960 6961 +1
=======================================
+ Hits 6935 6936 +1
Misses 25 25 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The closest thing I can think of is It performs an incremental reparse and hands you back a new tree with the edit you made. It's quite verbose in terms of what you have to provide (bytes and points) but this is a tree-sitter limitation (and I'm sure they had some reason for it). Note that For Air, I don't think Rowan trees are really intended to be edited. At least, there doesn't seem to be any easy to use API for that (and plus Rowan isn't exposed in any R package right now anyways) |
Interesting, yea the incremental re-parse is very neat, but more useful in an IDE setting. Here the latency of re-parse is not much concern as the edits are only a tiny fraction of the action run time.
Hmm, I guess in my mind something like {styler} / {air} is well-suited here if it exposes a friendly API for transformers, i.e. instead of the usual helpful rule like 'make this line <80 characters', we have a more adversarial rule like "add comments in random but syntactically valid places". I not be understanding where in the stack behind the format-on-save tool such an analog would sit. |
I may be misunderstanding what you mean but AFAIK the red trees in Rowan are modifiable. I believe this is used for refactorings in rust-analyzer. |
Part of #2191. Progress on #2737. Continuation of #2190.
For this initial PR, I've only added a rule about
FUNCTION
(function(...) { ... }
) andOP-LAMBDA
(\(...) { ... }
) equivalency.Hopefully my approach here is extensible for other rules (I tried for that). My plan is for this to only run on
main
, though it's certainly fast enough to run on every PR.The upshot is, it smoked out three linters with inconsistencies already!