getgrit / gritql

GritQL is a query language for searching, linting, and modifying code.
https://docs.grit.io/
MIT License
3.17k stars 82 forks source link

feat: call built-ins as predicate #557

Closed arendjr closed 4 weeks ago

arendjr commented 4 weeks ago

I also tried removing Predicate::Log in favor of Predicate::CallBuiltIn, but this turned out to be more complex, because the log implementation wants to inspect the variable being passed instead of only its value, so I left that as is for now.

Unfortunately, this leaves me without a good test case in this repo. Would you like me to create one?

Greptile Summary

This is an auto-generated summary

Hi! Looks like you've reached your API usage limit. You can increase it from your account settings page here: app.greptile.com/settings/usage

morgante commented 4 weeks ago

I also tried removing Predicate::Log in favor of Predicate::CallBuiltIn, but this turned out to be more complex, because the log implementation wants to inspect the variable being passed instead of only its value, so I left that as is for now.

We can probably ditch that functionality if it's making the merger harder. I don't consider it critical.

Unfortunately, this leaves me without a good test case in this repo. Would you like me to create one?

It would probably be good to have a simple one just as a test.

arendjr commented 4 weeks ago

Good news: I was able to move the inspection of the variable to the log compiler instead, so Predicate::Log and Pattern::Log are now both replaced with a built-in without loss of functionality.