You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test(sync): guard docs against code drift with sync tests
Add two compile-enforced anti-rot tests:
- `supported_languages_doc_lists_each_primary_extension` (in
`src/lang.rs`) fails if a language's primary extension disappears from
`docs/supported-languages.md`.
- `ffi_markers_are_documented` (in `src/ffi/sync_tests.rs`) fails if an
FFI marker or name prefix in the `SPECS` registry is absent from
`docs/ffi-support-matrix.md`.
Both tests require the doc to be updated in the same PR as the code,
making the "hand-maintained" caveat enforced rather than advisory.
To support the first test, expose `Language::ALL` (exhaustive slice of
every variant, guarded by `all_is_exhaustive`) and `Language::extensions`
(per-variant primary + alternate extensions). `from_extension` is
re-derived from `extensions()` to keep the mapping single-sourced.
Update `docs/ffi-support-matrix.md` and `CONTRIBUTING.md` to reflect
that the docs are now test-backed rather than purely hand-maintained.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,7 +90,7 @@ Every public-facing file starts with `// SPDX-License-Identifier: Apache-2.0`.
90
90
91
91
This is the most common contribution and it's mechanical once a grammar exists. The resolver is language-agnostic, so **cross-file edges work for free** once extraction emits correct facts.
92
92
93
-
> **Before you start:** check [`docs/supported-languages.md`](docs/supported-languages.md) for what's already covered (plus the candidate, not-feasible, and out-of-scope lists), and [`docs/ffi-support-matrix.md`](docs/ffi-support-matrix.md) for cross-language FFI boundaries. Both are hand-maintained against the code (`src/lang.rs` is the canonical language set) — update them in the same PR when you add a language or an FFI boundary.
93
+
> **Before you start:** check [`docs/supported-languages.md`](docs/supported-languages.md) for what's already covered (plus the candidate, not-feasible, and out-of-scope lists), and [`docs/ffi-support-matrix.md`](docs/ffi-support-matrix.md) for cross-language FFI boundaries. Both are guarded by sync tests — `supported-languages.md` against the `Language` enum in `src/lang.rs`, and `ffi-support-matrix.md` against the per-ABI `SPECS` registry in `src/ffi/` — so adding a language or an FFI boundary without updating the matching doc in the same PR fails the test.
94
94
95
95
> **First: is there a usable grammar?** code2graph pins `tree-sitter` to `>=0.24, <0.27`. A grammar crate must be compatible with that range. If no compatible grammar exists, read [When a language has no usable grammar](#when-a-language-has-no-usable-grammar) before writing any code.
0 commit comments