Skip to content

feat(rust): add Rust language extractor - #85

Merged
dejo1307 merged 13 commits into
mainfrom
feature/rust-extractor
Jul 15, 2026
Merged

feat(rust): add Rust language extractor#85
dejo1307 merged 13 commits into
mainfrom
feature/rust-extractor

Conversation

@GertL

@GertL GertL commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a Rust extractor (tree-sitter-based:

  • Symbols for fn/struct/enum/trait/type/const/static, with
    impl/trait and nested mod { } qualification (<dir>.<mod>.<Type>.<method>).
  • impl Trait for Typeimplements, attached to Type's own fact via a
    post-pass so it works even when the impl is declared in a different file
    than the type (also avoids double-counting)
  • use-based dependency facts classified internal/external/stdlib,
    with cross-crate and submodule resolution for Cargo workspaces.
  • calls/instantiates edges (tuple-call and named struct-literal
    construction) and per-function cyclomatic complexity.
  • Bare-call resolution through use imports.
  • Axum route detection (.route("/path", get(handler)), including chained
    verbs like get(a).post(b)), emitting route facts.

Adjusted the config.go (default extractor list, target/** ignore glob),
bootstrap.go, with docs updated in README.md/ARCHITECTURE.md.

Tested on dbt-core and Axum.

@GertL
GertL requested a review from dejo1307 July 10, 2026 05:11
@GertL
GertL force-pushed the feature/rust-extractor branch 2 times, most recently from 67b5469 to 72976e0 Compare July 14, 2026 03:41
@GertL

GertL commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

@dejo1307 quite a lot added here. Worth a review. Also feel free to decrease/highlight complexity if you see it.

GertL added 13 commits July 15, 2026 18:24
- Implemented comprehensive tests for Rust AST extraction in `rust_ast_test.go`, covering various Rust constructs such as structs, enums, traits, type aliases, constants, and method calls.
- Added tests for handling dependencies, including internal and external dependencies, and cross-crate workspace dependencies.
- Created utility functions for writing temporary Rust repositories for testing purposes in `rust_test.go`.
- Established detection tests for identifying Rust projects with and without `Cargo.toml`, including support for subdirectory monorepos.
@GertL
GertL force-pushed the feature/rust-extractor branch from 315160d to fc7c91d Compare July 15, 2026 17:11
@dejo1307
dejo1307 merged commit f8c6579 into main Jul 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants