Add Python Rust native extension detectors - #120
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds knowledge-base definitions and fixtures/tests so the detector can recognize Python projects that build Rust native extensions via Maturin or setuptools-rust.
Changes:
- Added KB tool definitions for
maturinandsetuptools-rustunder thenative_extensioncategory. - Added two Python+Rust fixture projects (pyproject + Cargo) to exercise positive detection paths.
- Extended
detect/detect_test.gowith project-level, signal-level, and near-miss tests for these detectors.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| testdata/setuptools-rust-project/src/lib.rs | Minimal Rust source file for setuptools-rust fixture. |
| testdata/setuptools-rust-project/pyproject.toml | setuptools-rust pyproject configuration used as a positive detection fixture. |
| testdata/setuptools-rust-project/Cargo.toml | Cargo manifest for setuptools-rust fixture (cdylib). |
| testdata/maturin-project/src/lib.rs | Minimal Rust source file for maturin fixture. |
| testdata/maturin-project/pyproject.toml | maturin pyproject configuration used as a positive detection fixture. |
| testdata/maturin-project/Cargo.toml | Cargo manifest for maturin fixture (cdylib). |
| knowledge/python/setuptools-rust.toml | New KB definition and detection signals for setuptools-rust native extensions. |
| knowledge/python/maturin.toml | New KB definition and detection signals for maturin native extensions. |
| detect/detect_test.go | Adds tests covering detection + near-miss behavior; adds a confidence-checking assertion helper. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| [package] | ||
| name = "maturin-project" | ||
| version = "0.1.0" | ||
| edition = "2024" |
| [package] | ||
| name = "setuptools-rust-project" | ||
| version = "0.1.0" | ||
| edition = "2024" |
Comment on lines
+1452
to
+1463
| t.Helper() | ||
| for _, tool := range r.Tools[category] { | ||
| if tool.Name != name { | ||
| continue | ||
| } | ||
| if tool.Confidence != confidence { | ||
| t.Errorf("%s confidence = %q, want %q", name, tool.Confidence, confidence) | ||
| } | ||
| return | ||
| } | ||
| t.Errorf("expected %s in %s category", name, category) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Maturin and setuptools-rust native extension definitions for Python projects. Detection covers parsed dependencies and their
pyproject.tomlorsetup.pyconfiguration, with fixtures for positive signals and prose-only near misses.