Skip to content

Commit a56a8f3

Browse files
davehentonclaudemarschattha
authored
feat(lang): add C and C++ language support (#2746)
## Summary - Add tree-sitter-based C and C++ language implementations for maintainability analysis (complexity, duplication, nested control flow, etc.) - Wire up tree-sitter dependencies, language registration in `ALL_LANGS`, file type/extension mappings, and protobuf enum mappings - Add integration test fixtures and test registration for both C and C++ ## Test plan - [x] Unit tests pass for both C and C++ language modules (11 tests) - [x] Integration tests pass for both `c_tests` and `cpp_tests` - [x] `cargo check` passes cleanly - [ ] CI passes 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: marschattha <arslan_21@rocketmail.com>
1 parent 6e7a156 commit a56a8f3

31 files changed

+3648
-2
lines changed

Cargo.lock

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ tracing-appender = "0.2.3"
127127
tracing-subscriber = { version = "0.3.20", features = ["env-filter"] }
128128
tracing-test = "0.2.5"
129129
tree-sitter = "0.22.6"
130+
tree-sitter-c = "0.21"
131+
tree-sitter-cpp = "0.21"
130132
tree-sitter-c-sharp = "0.21.3"
131133
tree-sitter-go = "0.21.2"
132134
tree-sitter-java = "0.21.0"

qlty-analysis/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ tempfile.workspace = true
3535
time.workspace = true
3636
tracing.workspace = true
3737
tree-sitter.workspace = true
38+
tree-sitter-c.workspace = true
39+
tree-sitter-cpp.workspace = true
3840
tree-sitter-c-sharp.workspace = true
3941
tree-sitter-go.workspace = true
4042
tree-sitter-java.workspace = true

qlty-analysis/src/lang.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ use core::fmt;
33
use std::sync::Arc;
44
use tree_sitter::{Node, Parser, Query};
55

6+
mod c;
7+
mod cpp;
68
mod csharp;
79
mod go;
810
mod java;
@@ -18,8 +20,8 @@ mod typescript;
1820
mod typescript_common;
1921

2022
pub use {
21-
csharp::*, go::*, java::*, javascript::*, kotlin::*, php::*, python::*, ruby::*, rust::*,
22-
swift::*, tsx::*, typescript::*,
23+
c::*, cpp::*, csharp::*, go::*, java::*, javascript::*, kotlin::*, php::*, python::*, ruby::*,
24+
rust::*, swift::*, tsx::*, typescript::*,
2325
};
2426

2527
#[allow(clippy::borrowed_box)]
@@ -32,6 +34,8 @@ use lazy_static::lazy_static;
3234
lazy_static! {
3335
pub static ref ALL_LANGS: Vec<Box<dyn Language + Sync>> = {
3436
vec![
37+
Box::<c::C>::default(),
38+
Box::<cpp::Cpp>::default(),
3539
Box::<csharp::CSharp>::default(),
3640
Box::<php::Php>::default(),
3741
Box::<kotlin::Kotlin>::default(),

0 commit comments

Comments
 (0)