ast-grep

ast-grep is a command line tool that uses the abstract syntax tree (AST) structure instead of text-based search on the codebase. With Tree-sitter infrastructure, it performs structural search, static analysis, and batch code editing on code. Users can manage matching and rewriting processes by identifying code pieces through patterns.

AS

ast-grep · Code Quality & Review

STARS16.4K
FORKS488
COMMITS4.4K
CONTRIBUTORS91
VERSION0.45.3
UPDATEDtoday
RustStatic AnalysisASTKod DüzenlemeMIT

Common commercial products in this category: SonarCloud, Codacy, DeepSource

What can it do?
  • You can search for specific syntax structures in your codebase using patterns.
  • You can automatically rewrite the blocks of code you detect.
  • You can perform light-scale static analysis and code edits on your projects.
User reviews
  • ↑ PositiveHacker News

    AST-grep(sg) is a CLI tool for code structural search, lint, and rewriting

    “Hi, ast-grep author here. This is a great question and I asked this in the first place before I started the hobby project. TLDR; I designed ast-grep to be on different tracks than semgrep. Semgrep is for security and ast-grep is for development. First and foremost, I have always…”

  • ↓ NegativeHacker News

    AST-grep(sg) is a CLI tool for code structural search, lint, and rewriting

    “Why I think semgrep is a security tool different from ast-grep: * Semgrep is security focused. It has many advanced static analysis features in its core product, such as dataflow analysis, symbolic propagation, and semantic equivalence, all of which are useful for security…”

My note

Alternative pages

More in: Code Quality & Review