The code graph now covers C and C#, the first PR of t82.
C (.c, .h)
Nodes: functions, typedefs, and structs, unions and enums with a body. The scan also looks inside #if blocks.
Entry points: main and interrupt handlers, in every common firmware spelling:
the ISR(...), SIGNAL(...) and INTERRUPT(...) macros;
the interrupt, __interrupt and __signal__ keywords;
CodeVision's interrupt [..].
Edges: calls by name and #includes.
Two #ifdef alternatives of one function share one node.
C# (.cs)
Nodes: classes, structs, interfaces, records, enums, methods and constructors. Nested types are named Outer.Inner.
Edges: base types (Implements for I-names, otherwise Inherits) and calls, including new.
Entry points:
static Main;
methods with the [Http*], [Route], [AcceptVerbs] or [WebMethod] attributes;
IHttpHandler.ProcessRequest;
public and protected methods of controllers, Razor pages, SignalR hubs, Web Forms pages, user controls and web services.
Overloads share one node and keep the calls from every body.
Changes in the shared graph code (needed for C to scale):
Edge resolution uses a name index instead of scanning every node per edge. When names clash it prefers a node in the calling file, which matters for C static functions. Matches are sorted, so a rebuild links the same way. Includes resolve to the header file.
Community detection was rewritten as an O(nodes + edges) local-move pass, replacing the quadratic one. The agent called it a second time after the build; that call is removed.
On the public FreeRTOS kernel the graph build drops from 6.9 s to 1.2 s.
This changes the stored community ids and counts for every language, not only C and C#. Communities are now numbered in node order, so the same graph always gets the same numbers.
CI never linted or tested compliance-graph. This adds a "Clippy (graph)" step and adds the crate to the tests step.
The Rust parser's test module moved below the impl, as clippy's items_after_test_module asks.
Watch the first nightly after this lands. The firmware fixtures get a real code graph for the first time, so some triage drift from the baseline is expected.
Tests
All 100 graph unit tests pass.
New tests cover:
C entry points, including the false positives a parameter named signal or a type named interrupt_state_t would cause;
#ifdef alternatives;
code that doesn't parse;
C# namespace forms, framework entry points, overloads and the interface name convention;
resolution: same file first, determinism, includes resolving to the header.
Clippy with the CI flags is clean for the graph crate and the agent.
Checked on public code:
FreeRTOS-Kernel: 6,522 nodes, 62 interrupt handlers as entry points.
eShopOnWeb: 980 nodes, 44 page handlers as entry points.
The C# grammar is pinned to =0.23.1: 0.23.5 needs a tree-sitter core newer than our 0.24.
Followed by #936 (PLC programs, function blocks and functions in the graph) and #937 (the graph card on the target page).
The code graph now covers C and C#, the first PR of t82.
**C** (`.c`, `.h`)
- Nodes: functions, typedefs, and structs, unions and enums with a body. The scan also looks inside `#if` blocks.
- Entry points: `main` and interrupt handlers, in every common firmware spelling:
- the `ISR(...)`, `SIGNAL(...)` and `INTERRUPT(...)` macros;
- the `interrupt`, `__interrupt` and `__signal__` keywords;
- CodeVision's `interrupt [..]`.
- Edges: calls by name and `#include`s.
- Two `#ifdef` alternatives of one function share one node.
**C#** (`.cs`)
- Nodes: classes, structs, interfaces, records, enums, methods and constructors. Nested types are named `Outer.Inner`.
- Edges: base types (Implements for `I`-names, otherwise Inherits) and calls, including `new`.
- Entry points:
- static `Main`;
- methods with the `[Http*]`, `[Route]`, `[AcceptVerbs]` or `[WebMethod]` attributes;
- `IHttpHandler.ProcessRequest`;
- public and protected methods of controllers, Razor pages, SignalR hubs, Web Forms pages, user controls and web services.
- Overloads share one node and keep the calls from every body.
**Changes in the shared graph code** (needed for C to scale):
- **Edge resolution** uses a name index instead of scanning every node per edge. When names clash it prefers a node in the calling file, which matters for C `static` functions. Matches are sorted, so a rebuild links the same way. Includes resolve to the header file.
- **Community detection** was rewritten as an O(nodes + edges) local-move pass, replacing the quadratic one. The agent called it a second time after the build; that call is removed.
- On the public FreeRTOS kernel the graph build drops from 6.9 s to 1.2 s.
- **This changes the stored community ids and counts for every language, not only C and C#.** Communities are now numbered in node order, so the same graph always gets the same numbers.
- **CI** never linted or tested `compliance-graph`. This adds a "Clippy (graph)" step and adds the crate to the tests step.
- The Rust parser's test module moved below the impl, as clippy's `items_after_test_module` asks.
**Watch the first nightly after this lands.** The firmware fixtures get a real code graph for the first time, so some triage drift from the baseline is expected.
**Tests**
- All 100 graph unit tests pass.
- New tests cover:
- C entry points, including the false positives a parameter named `signal` or a type named `interrupt_state_t` would cause;
- `#ifdef` alternatives;
- code that doesn't parse;
- C# namespace forms, framework entry points, overloads and the interface name convention;
- resolution: same file first, determinism, includes resolving to the header.
- Clippy with the CI flags is clean for the graph crate and the agent.
**Checked on public code:**
- FreeRTOS-Kernel: 6,522 nodes, 62 interrupt handlers as entry points.
- eShopOnWeb: 980 nodes, 44 page handlers as entry points.
The C# grammar is pinned to `=0.23.1`: 0.23.5 needs a tree-sitter core newer than our 0.24.
Followed by #936 (PLC programs, function blocks and functions in the graph) and #937 (the graph card on the target page).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Customer code is mostly C firmware and C#/ASP.NET, which the graph didn't
parse, so their graphs were nearly empty.
- C: functions, structs, unions, enums (including typedef'd ones and those
inside #if blocks), calls by name and #includes. main and interrupt
handlers are entry points, in the avr-gcc ISR(), CodeVision, SDCC, IAR and
GCC attribute spellings.
- C#: classes, structs, interfaces, records, enums, methods and
constructors, base types (Implements for IName), calls and constructions.
Entry points are Main and what a web framework calls: controller actions,
[Http*]/[Route]/[WebMethod] methods, Razor page handlers, Web Forms
pages and controls, IHttpHandler.ProcessRequest.
- Overloads and #ifdef/#else alternatives share one qualified name: they
give one node (an entry point if any of them is), and the calls of every
body count. Before, the graph kept the last and orphaned the others.
- tree-sitter-c 0.23.4; tree-sitter-c-sharp pinned to 0.23.1, as 0.23.5 is
built for grammar ABI 15 and our tree-sitter 0.24 reads up to 14.
- Edge resolution goes through an index by last name segment instead of
scanning every node per edge. When several nodes match it prefers the
edge's own file (C static functions), then the first by name, so a
rebuild links the same way. #include "uart.h" now links to the header.
- Community detection kept its totals up to date only by re-summing all
nodes for every node (quadratic per pass), and ran twice per build. It
now costs O(nodes + edges) per pass and runs once, in the build. The
FreeRTOS kernel (6,500 nodes) builds in 1.2 s instead of 6.9 s.
- compliance-graph joins CI's clippy and test steps. Its tests never ran
in CI before. The Rust parser's tests move below its last impl (clippy).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
The code graph now covers C and C#, the first PR of t82.
C (
.c,.h)#ifblocks.mainand interrupt handlers, in every common firmware spelling:ISR(...),SIGNAL(...)andINTERRUPT(...)macros;interrupt,__interruptand__signal__keywords;interrupt [..].#includes.#ifdefalternatives of one function share one node.C# (
.cs)Outer.Inner.I-names, otherwise Inherits) and calls, includingnew.Main;[Http*],[Route],[AcceptVerbs]or[WebMethod]attributes;IHttpHandler.ProcessRequest;Changes in the shared graph code (needed for C to scale):
staticfunctions. Matches are sorted, so a rebuild links the same way. Includes resolve to the header file.compliance-graph. This adds a "Clippy (graph)" step and adds the crate to the tests step.items_after_test_moduleasks.Watch the first nightly after this lands. The firmware fixtures get a real code graph for the first time, so some triage drift from the baseline is expected.
Tests
signalor a type namedinterrupt_state_twould cause;#ifdefalternatives;Checked on public code:
The C# grammar is pinned to
=0.23.1: 0.23.5 needs a tree-sitter core newer than our 0.24.Followed by #936 (PLC programs, function blocks and functions in the graph) and #937 (the graph card on the target page).
🤖 Generated with Claude Code