3 ms·
So an awk but that knows how to walk structures instead of just lines. Excellent! I'm a big fan of semgrep letting me query ASTs, this feels like something in
by rtpg 2y ago
So an awk but that knows how to walk structures instead of just lines. Excellent!
I'm a big fan of semgrep letting me query ASTs, this feels like something in a similar space. Down with lines, up with everything being trees!
- pdimitar 2y agoHave you checked ast-grep and gritql?
- normie3000 2y agoAre these alternatives to semgrep?
- pdimitar 2y agoMore or less, yes. CLI, offline, no need for a cloud account. Used ast-grep successfully to locate bad code blocks (dynamic typing, don't even get me started) and also to replace them with others. Highly recommended.
- dbaupp 2y agoSemgrep also a CLI, that can run offline and without a cloud account. At work, we use it for enforcing a bunch of custom lint rules configured as a yaml file committed directly to our repo, entirely cloud-free. (I may be overreading your comment as suggesting that these were reasons to use ast-grep over semgrep.)
- pdimitar 2y agoAs the other sibling commenter said, both `ast-grep` and `gritql` are based on Treesitter which means that you can in fact just look for certain function call and it will be found no matter how it's formatted, something that plain grep and sometimes semgrep I am not sure can do. I have used `ast-grep` to devise my own linters with crushing success.
- gregwebs 2y agoast-grep is based on treesitter. I found Semgrep great for simple things but impossible due to edge cases for complicated things. ast-grep is more difficult for simple cases but all the information you need is there for complex cases.
- beardedwizard 2y agoSemgrep is also based on tree sitter
- PROMISE_237 2y ago[dead]