V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
ALLROBOT
V2EX  ›  问与答

semgrep VS ast-grep 代码搜索重构工具,哪个更好用?

  •  1
     
  •   ALLROBOT · 22 天前 · 441 次点击
    https://github.com/ast-grep/ast-grep
    https://github.com/semgrep/semgrep

    两个都是代码搜索,然后重构,有别于正则表达式搜索替换的工具

    有用过的人说一下使用体验吗?感觉两者相比如何,哪个用起来更方便
    4 条回复    2024-06-12 03:27:02 +08:00
    Al0rid4l
        1
    Al0rid4l  
       22 天前
    在用 ast-grep, semgrep 没有过, 看起来 ast-grep 更简单一点

    作者 @hdnvim 自己的评价在 /t/1006506
    hdnvim
        2
    hdnvim  
       5 天前
    谢谢提问!如果是做搜索和重构的话,推荐 ast-grep ,ast-grep 的重写有更多选项。如果是要做安全审计的话可以试试 semgrep 。
    hdnvim
        3
    hdnvim  
       5 天前
    @hdnvim ast-grep 有专门文档记录怎么重写代码 https://ast-grep.github.io/guide/rewrite-code.html

    semgrep 相对而言 fix 还比较 experimental
    hdnvim
        4
    hdnvim  
       5 天前
    @Al0rid4l 谢谢推荐!!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1110 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 19:02 · PVG 03:02 · LAX 12:02 · JFK 15:02
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.