Repository navigation
ci: use ast-grep to check that platform code stays in brush_core::sys - #1430
Merged
Merged
Conversation
reubeno
marked this pull request as ready for review
October 2, 2026 16:13
Add ast-grep pre-commit hooks and a first rule, platform-cfg-outside-sys, which flags target cfgs in brush-core outside the sys module: cfg and cfg_attr attributes, cfg! and cfg_select!, and #[cfg] inside macro bodies such as cfg_if! and macro_rules!. Platform code outside sys can only exist behind such a cfg -- otherwise a cross-compiled CI target fails to build -- so flagging the cfgs is enough to keep it out, and matching the syntax tree sees every platform's code in one pass. The 12 existing gates are baselined in place. The hook runs with --error=unused-suppression, so the baseline can only shrink. Rule tests pin down which forms the rule must and mustn't match, and run whenever the rules change. sgconfig.yml points at rules and tests kept under .config/ast-grep/. Also pin every third-party hook to a full commit SHA, with a `# frozen: <tag>` comment, as GitHub Actions are, since a tag can be moved to point at different code. Dependabot updates both the SHA and the comment, except for lychee, whose prefixed tags it can't rewrite in the comment. Assisted-by: Claude Code:claude-opus-5-5
reubeno
force-pushed
the
ast-grep-platform-lint
branch
from
October 2, 2026 16:13
85a6cf2 to
9bc9f51
Compare
Test Results 5 files 53 suites 21m 12s ⏱️ Results for commit 9bc9f51. |
Performance Benchmark Report
Code Coverage Report: Only Changed Files listed
Minimum allowed coverage is 🧪 End-to-end suites🟡 7/7 adapters passed · 2324 tests · 2053 ✅ (93.5%) · 108 ❌ · 34 ❎ · 129 ⏩ · ⏱ 11m28.6s
❌ bash-completion · 108 failed
⏩ bash-completion · 128 did not run
⏩ fzf · 1 did not run
📎 Run logs · artifact |
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.
ast-grepwith a new rule checking that platform-specific code is confined to thesysmodule.Assisted-by: Claude Code:claude-opus-5-5