Repository navigation
ci: scan src/*.mc with CodeQL via minicompiler/codeql-mc - #56
Merged
Merged
Conversation
mc-php's real sources are .mc, which github/codeql-action cannot analyze (custom languages are unsupported, issue #3015). Add an independent `mc` job to the CodeQL workflow that builds the minicompiler/codeql-mc extractor, creates a CodeQL database over src/, analyzes it with the mc queries, and uploads the SARIF through github/codeql-action/upload-sarif (category mc). The job is separate from the existing actions/c-cpp analyze matrix, so a failure here cannot affect those jobs, and it fails loudly (no continue-on-error) if the extractor build or the scan breaks. codeql-mc is pinned by commit SHA; the CodeQL CLI is pinned to 2.27.1 and Rust to 1.96.0. On the current src/ the mc queries report 3 empty control-flow bodies and 2 unused locals, all true positives. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The isolated workflow matches the extractor’s integration approach, with no substantiated blocking issues remaining.
Review effort: Balanced
Findings: None
What changed in this PR
Adds CodeQL scanning for mc-php’s compiler sources alongside the existing Actions and C/C++ analysis.
Changes:
- Adds an independent
mcanalysis job with pinned extractor and toolchain versions. - Scans
src/with two mc queries and uploads SARIF results.
| File | Description |
|---|---|
.github/workflows/codeql.yml |
Builds the extractor, scans mc sources, and uploads alerts. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
What
mc-php's real source is
.mc, which GitHub'sgithub/codeql-actioncannot analyze — custom languages are unsupported (codeql-action#3015). This adds an independentmcjob to.github/workflows/codeql.ymlthat scanssrc/*.mcwith theminicompiler/codeql-mcextractor and surfaces the results as code-scanning alerts.The chain (standard hosted runner, no self-hosting):
Safety / robustness
mcjob is separate from the existinganalyzematrix (actions,c-cpp), which is left untouched. A failure inmccannot cancel or affect those jobs.continue-on-error) if the extractor build or the scan breaks.codeql-mcby commit SHA, CodeQL CLI2.27.1, Rust1.96.0(andcodeql-mc's ownCargo.lock/ extractor rev).What it finds today
Run locally against the current
src/(33 files, ~17.8k lines), all true positives, no parse-artifact false positives:mc/empty-control-body(3) — empty control-flow bodies:builtin.mc:1467if (first) { }ns.mc:216if (ph_accept("\\", 1)) {}(consume-if-present with an empty body)rc.mc:348empty first branch of anif/else-ifchainmc/unused-local(2) — locals declared but never read:class.mc:418i64 save = ph_tid;(the name appears only at its declaration)expr.mc:1160i64 arop = ph_arith_op(t);(likewise never read)The two queries are designed so a grammar gap yields a missed finding, never a spurious one (structural check for empty bodies; a conservative name-based use test for unused locals —
&x,x += …andx++all count as uses). See the codeql-mc README for scope and limits.🤖 Generated with Claude Code