feat: add Rust language support with cognitive complexity analysis#327
Conversation
- Add RustMetricsAnalyzer using tree-sitter-rust@0.21.0 - Register 'rust' language in MetricsAnalyzerFactory - Add onLanguage:rust activation event in package.json - Add 11 unit tests for Rust analyzer (79→90 passing) - Add samples/Test.rs for manual extension testing Supports: fn items, impl methods (qualified as Type::method), if/for/while/loop/match expressions, logical && and || operators, closures (when nested), and labeled break/continue. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@copilot resolve the merge conflicts in this pull request |
There was a problem hiding this comment.
Pull request overview
Adds Rust language support to the VS Code “code-metrics” extension by introducing a new Tree-sitter-based Rust cognitive complexity analyzer, wiring it into the analyzer factory, and updating the extension manifest and tests so Rust files can be analyzed and displayed via CodeLens.
Changes:
- Added
RustMetricsAnalyzer(Tree-sitter Rust) and registered therustlanguage ID inMetricsAnalyzerFactory. - Updated extension manifest to activate on Rust files and added
tree-sitter-rustdependency. - Added Rust-focused unit tests and a
samples/Test.rsfile for manual verification.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/metricsAnalyzer/languages/rustAnalyzer.ts | New Rust cognitive complexity analyzer implementation. |
| src/metricsAnalyzer/metricsAnalyzerFactory.ts | Registers Rust analyzer under the rust language ID. |
| src/unit/unit.test.ts | Adds Rust analyzer unit tests and updates supported-language expectations. |
| package.json | Adds Rust activation event/keyword and tree-sitter-rust dependency. |
| package-lock.json | Locks the new tree-sitter-rust package (but currently with a specifier mismatch). |
| samples/Test.rs | Adds a Rust sample file to exercise analyzer behavior manually. |
…-support-20260517-0a08249a10a9bb4a # Conflicts: # src/unit/unit.test.ts Co-authored-by: askpt <2493377+askpt@users.noreply.github.com>
Resolved and pushed in commit Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Agent-Logs-Url: https://github.com/askpt/code-metrics/sessions/dfda748d-077c-45d3-906c-0fd89a60fa7b Co-authored-by: askpt <2493377+askpt@users.noreply.github.com>
Agent-Logs-Url: https://github.com/askpt/code-metrics/sessions/dfda748d-077c-45d3-906c-0fd89a60fa7b Co-authored-by: askpt <2493377+askpt@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot Make sure the READMEs are updated and the tests that are added run in the CI |
Agent-Logs-Url: https://github.com/askpt/code-metrics/sessions/20982020-8f3c-40b1-bd36-157637830977 Co-authored-by: askpt <2493377+askpt@users.noreply.github.com>
Addressed in commit 3bb2e5d. README now includes Rust in supported languages, and CI now runs Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #327 +/- ##
==========================================
+ Coverage 73.66% 76.23% +2.57%
==========================================
Files 12 13 +1
Lines 3535 3981 +446
Branches 364 428 +64
==========================================
+ Hits 2604 3035 +431
- Misses 929 944 +15
Partials 2 2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Agent-Logs-Url: https://github.com/askpt/code-metrics/sessions/a9b2c72f-f6af-4944-a9bb-e01199a120fd Co-authored-by: askpt <2493377+askpt@users.noreply.github.com>
Agent-Logs-Url: https://github.com/askpt/code-metrics/sessions/a9b2c72f-f6af-4944-a9bb-e01199a120fd Co-authored-by: askpt <2493377+askpt@users.noreply.github.com>
Supports: fn items, impl methods (qualified as Type::method), if/for/while/loop/match expressions, logical && and || operators, closures (when nested), and labeled break/continue.
Closes #315