Draft
Conversation
Introduces scripts/generate_rules/misra_help/, a two-stage pipeline for (mostly) idempotent generation of per-query .md help files. Uses MISRA rules as input and creates (or updates, as needed) documentation for codeql-coding-standards queries for C and C++. Focuses on immediate support for: - MISRA C 2012/2023 - MISRA C++ 2023. Stage 1: deterministic docling-based extraction and rendering, with a JSON sidecar for downstream consumption. Stage 2: a headless Python driver for the Copilot SDK that rewrites each help file from the JSON sidecar against a fixed Markdown schema and American English spelling. Adds docs via -> "scripts/generate_rules/misra_help/README.md"
| # Drop trailing references of the form "C90 [...]" / "C99 [...]" etc. | ||
| s = re.sub( | ||
| r"\s+(?:C90|C99|C11|C17|C18)\s*\[[^\]]*\]" | ||
| r"(?:\s*[,;]?\s*(?:C90|C99|C11|C17|C18)\s*\[[^\]]*\])*\s*$", |
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.
Introduces
scripts/generate_rules/misra_help/, a two-stage pipeline for (mostly) idempotent generation of per-query.mdhelp files. It uses MISRA rule text as input and creates (or updates) documentation forcodeql-coding-standardsqueries in C and C++.Initial supported standards:
Stage 1 — deterministic, docling-based extraction and rendering, with a JSON sidecar for downstream consumption.
Stage 2 — a headless Python driver for the Copilot SDK that rewrites each help file from the JSON sidecar against a fixed Markdown schema, normalized to American English.
See
scripts/generate_rules/misra_help/README.mdfor usage, architecture, and operational notes.Description
Adds a new internal tooling package under
scripts/generate_rules/misra_help/that automates generation of per-query Markdown help files for MISRA C/C++ queries. No query files, query metadata, rule packages, shared libraries, tests,.expectedfiles, or release artifacts are modified by this PR — it is purely additive tooling (7 new files, ~2.1k lines, all underscripts/generate_rules/misra_help/).The pipeline is split so that the deterministic extraction stage can be re-run cheaply and audited independently of the LLM-driven rewrite stage. The JSON sidecar is the contract between the two stages, which keeps Stage 2 reproducible against a pinned input.
Change request type
.ql,.qll,.qlsor unit tests)Rules with added or modified queries
Release change checklist
A change note (development_handbook.md#change-notes) is required for any pull request which modifies:
If you are only adding new rule queries, a change note is not required.
Author: Is a change note required?
scripts/generate_rules/misra_help/; no release artifacts, query results, or query performance are affected.🚨🚨🚨
Reviewer: Confirm that format of shared queries (not the .qll file, the
.ql file that imports it) is valid by running them within VS Code.
.ql/.qllfiles modified.Reviewer: Confirm that either a change note is not required or the change note is required and has been added.
Query development review checklist
For PRs that add new queries or modify existing queries, the following checklist should be completed by both the author and reviewer:
Author
As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
Reviewer
As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.