CodeFuse-Query  by codefuse-ai

Query-based static code analysis engine

created 1 year ago
317 stars

Top 86.5% on sourcepulse

GitHubView on GitHub
Project Summary

CodeFuse-Query is a data-centric static code analysis system designed for large-scale software development, addressing the limitations of traditional tools. It enables multifaceted code analysis by transforming source code into a standardized data model (COREF) and querying it using a Datalog-based DSL called Gödel. This approach allows for efficient, reusable, and declarative analysis of codebases exceeding billions of lines.

How It Works

CodeFuse-Query treats code analysis as a data computation task. It converts source code into a comprehensive data model called COREF, which includes Abstract Syntax Trees (AST), Abstract Semantic Graphs (ASG), Control Flow Graphs (CFG), Program Dependency Graphs (PDG), Call Graphs, Class Hierarchies, and documentation. This structured data is then queried using Gödel, a Datalog-based Domain-Specific Language. Gödel's declarative nature and Datalog's properties like monotonicity and termination enable efficient formulation and execution of complex, recursive queries that are challenging for traditional SQL or imperative approaches.

Quick Start & Requirements

  • Installation: Sparrow CLI is available for local execution.
  • Prerequisites: Supports 11 languages, with mature support for Java, JavaScript, TypeScript, XML, and Go. Beta support exists for Object-C, C++, Python3, Swift, SQL, and Properties.
  • Resources: Capable of scanning over 10 billion lines of code daily.
  • Documentation: Installation, Configuration, and Running, GödelScript Query Language, Online Tutorial.

Highlighted Details

  • Processes over 10 billion lines of code daily.
  • Supports over 300 different analysis tasks.
  • Utilizes a two-tiered schema, COREF, integrating AST, ASG, CFG, PDG, Call Graph, Class Hierarchy, and Documentation.
  • Gödel DSL offers advantages over SQL for recursive algorithms and complex queries.

Maintenance & Community

  • Key contributors include individuals from Nanjing University, Ant Group, and Alibaba Inc.
  • A paper on language-agnostic change impact analysis has been accepted by ICSE 2025.
  • Star History available.

Licensing & Compatibility

  • The repository does not explicitly state a license in the README.

Limitations & Caveats

  • CFG and PDG information are still under construction and not fully supported for all languages.
  • Beta support for several languages (Object-C, C++, Python3, Swift, SQL, Properties) indicates potential for further refinement and bug fixes.
Health Check
Last commit

1 month ago

Responsiveness

1 week

Pull Requests (30d)
1
Issues (30d)
0
Star History
23 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.