Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved rule-detection defects, ineffective test fixtures, and permissive edition-tag validation can hide violations and leave new MISRA-C-2025 coverage unverified.
8 open issues
Initializer check suppresses header violations across translation units · New SinglePointOfExit wrapper lacks runnable test artifacts · New Test category-based suppression with a local multi-return function · New Keep the extractor flag in the options directive · New Test the shared assert expansion and retain the NDEBUG control · New Matrix runner skips shared fixtures and requests missing .qlref files · New Include all applicable rules in the MISRA-C-2025 supported-rules list · New Non-edition tags incorrectly satisfy the edition-tag requirement · New
What changed in this PR
Prepares the CodeQL coding-standards project for MISRA C:2025 development through representative end-to-end examples, while retaining older-edition suites. This establishes migration infrastructure, not complete coverage or qualification.
Changes:
- Adds and adapts queries, metadata, and tests for seven categories of guideline changes.
- Updates edition selection and supports reactivating guidelines that are Disapplied by default.
- Extends generation, validation, release tooling, and documentation for the migration.
| File | Description |
|---|---|
scripts/verify_rule_package_consistency.py |
Extends MISRA C tag validation. |
scripts/validate-amendments-csv.py |
Allows historical amendment mappings. |
scripts/release/generate_release_notes.py |
Adds the 2025 release-notes category. |
scripts/release/create_supported_rules_list.py |
Adds the 2025 coverage category. |
scripts/PSCodingStandards/Get-TestDirectory.ps1 |
Maps 2025 queries to MISRA tests. |
scripts/PSCodingStandards/Config.ps1 |
Registers the 2025 suite. |
scripts/matrix_testing/CreateMatrixTestReport.ps1 |
Accepts 2025 matrix-test selection. |
scripts/generate_rules/generate_package_files.py |
Supports 2025 metadata and test reuse. |
scripts/generate_rules/coding_standards_utils.py |
Copies tags and reuses help templates. |
schemas/rule-package.schema.json |
Adds 2025 metadata and categories. |
rules.csv |
Updates the guideline inventory. |
rules-misra-c-2025.csv |
Tracks migration categories and progress. |
rule_packages/c/Types1.json |
Registers refined and legacy type queries. |
rule_packages/c/Static.json |
Marks Rule 17.6 as legacy. |
rule_packages/c/Statements5.json |
Registers Disapplied Rule 15.5. |
rule_packages/c/Preprocessor4.json |
Registers renumbered Rule 20.15. |
rule_packages/c/Pointers1.json |
Records planned Rule 11.11. |
rule_packages/c/Language3.json |
Registers renumbered Directive 1.2. |
rule_packages/c/Declarations6.json |
Adds Rule 17.3 applicability. |
rule_packages/c/Declarations5.json |
Registers new declaration guidelines. |
rule_packages/c/Declarations1.json |
Registers renumbered Rule 5.10. |
rule_packages/c/Contracts7.json |
Records planned Rule 19.3. |
rule_packages/c/Contracts6.json |
Adds Rule 17.5 applicability. |
rule_packages/c/Banned.json |
Adds Rule 21.8 applicability. |
docs/user_manual.md |
Explains edition selection and reactivation. |
docs/design/guideline_recategorization.md |
Documents promotions from Disapplied. |
cpp/common/test/guideline_recategorizations/DisappliedRecategorizations.ql |
Tests Disapplied-category promotions. |
cpp/common/test/guideline_recategorizations/DisappliedRecategorizations.expected |
Records expected promotion results. |
cpp/common/src/codingstandards/cpp/guideline_recategorizations/GuidelineRecategorizations.qll |
Implements promotions from Disapplied. |
cpp/common/src/codingstandards/cpp/exclusions/c/Types1.qll |
Registers integer-type query exclusions. |
cpp/common/src/codingstandards/cpp/exclusions/c/Statements5.qll |
Registers Disapplied query metadata. |
cpp/common/src/codingstandards/cpp/exclusions/c/Preprocessor4.qll |
Registers Rule 20.15 exclusions. |
cpp/common/src/codingstandards/cpp/exclusions/c/Language3.qll |
Registers Directive 1.2 exclusions. |
cpp/common/src/codingstandards/cpp/exclusions/c/Declarations5.qll |
Registers Rule 8.18 exclusions. |
cpp/common/src/codingstandards/cpp/exclusions/c/Declarations1.qll |
Registers Rule 5.10 exclusions. |
change_notes/2026-11-03-misra-c-2025-query-updates.md |
Records suite and query changes. |
c/misra/test/rules/RULE-8-18/test.c |
Adds source-file and local controls. |
c/misra/test/rules/RULE-8-18/sample.h |
Adds tentative-definition cases. |
c/misra/test/rules/RULE-8-18/DefinitionsInHeader.qlref |
Selects the new header query. |
c/misra/test/rules/RULE-8-18/DefinitionsInHeader.expected |
Records expected header alerts. |
c/misra/test/rules/RULE-5-10/ReservedIdentifierDeclared.testref |
References shared reserved-identifier coverage. |
c/misra/test/rules/RULE-21-8/test.c |
Adds enabled and disabled assertions. |
c/misra/test/rules/RULE-21-8/TerminationFunctionsOfStdlibhUsed.expected |
Adds the enabled-assertion result. |
c/misra/test/rules/RULE-21-8/assert.h |
Supplies a local assertion fixture. |
c/misra/test/rules/RULE-20-15/ReservedMacroName.testref |
References legacy reserved-macro coverage. |
c/misra/test/rules/RULE-17-5/UseOfArrayStatic_MISRA_C_2012.qlref |
Selects the legacy static-parameter query. |
c/misra/test/rules/RULE-17-5/UseOfArrayStatic_MISRA_C_2012.expected |
Records the legacy prohibition result. |
c/misra/test/rules/RULE-17-5/test_MISRA_C_2025.c |
Tests static and ordinary array contracts. |
c/misra/test/rules/RULE-17-5/ArrayFunctionArgumentNumberOfElements.expected |
Adds array-contract results. |
c/misra/test/rules/RULE-17-3/test_c99.c |
Adds C99 implicit-declaration coverage. |
c/misra/test/rules/RULE-17-3/FunctionDeclaredImplicitly.expected |
Adds the C99 expected alert. |
c/misra/test/rules/RULE-15-5/unconfigured/test.c |
Reuses the exit-count fixture. |
c/misra/test/rules/RULE-15-5/unconfigured/SinglePointOfExit.qlref |
Selects the unconfigured 2025 query. |
c/misra/test/rules/RULE-15-5/unconfigured/SinglePointOfExit.expected |
Expects default suppression. |
c/misra/test/rules/RULE-15-5/SinglePointOfExit.testref |
References legacy exit-count coverage. |
c/misra/test/rules/RULE-15-5/coding-standards.yml |
Configures promotion to Required. |
c/misra/test/rules/RULE-15-5/coding-standards.xml |
Stores generated recategorization configuration. |
c/misra/test/rules/DIR-4-6/test.c |
Clarifies edition-specific test annotations. |
c/misra/test/rules/DIR-4-6/test_MISRA_C_2025.c |
Adds floating-point alias controls. |
c/misra/test/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.expected |
Records legacy floating-point alias results. |
c/misra/test/rules/DIR-4-6/PlainIntegerTypeUsedOverExplicitTypedef.qlref |
Selects the integer-only variant. |
c/misra/test/rules/DIR-4-6/PlainIntegerTypeUsedOverExplicitTypedef.expected |
Records integer-only expected results. |
c/misra/test/rules/DIR-1-2/LanguageExtensionsShouldBeMinimized.testref |
References legacy extension coverage. |
c/misra/src/rules/RULE-8-18/DefinitionsInHeader.ql |
Detects tentative definitions in headers. |
c/misra/src/rules/RULE-5-10/ReservedIdentifierDeclared.ql |
Adds the renumbered identifier wrapper. |
c/misra/src/rules/RULE-21-8/TerminationFunctionsOfStdlibhUsed.ql |
Adds 2025 applicability metadata. |
c/misra/src/rules/RULE-21-2/DoNotDeclareAReservedIdentifier.ql |
Marks the identifier wrapper as legacy. |
c/misra/src/rules/RULE-21-1/DefineAndUndefUsedOnReservedIdentifierOrMacroName.ql |
Reuses reserved-macro detection as legacy. |
c/misra/src/rules/RULE-20-15/ReservedMacroName.ql |
Adds the renumbered macro wrapper. |
c/misra/src/rules/RULE-17-6/UseOfArrayStatic.ql |
Marks the prohibition as legacy. |
c/misra/src/rules/RULE-17-5/ArrayFunctionArgumentNumberOfElements.ql |
Adds 2025 applicability metadata. |
c/misra/src/rules/RULE-17-3/FunctionDeclaredImplicitly.ql |
Adds 2025 applicability metadata. |
c/misra/src/rules/RULE-15-5/SinglePointOfExit.ql |
Adds the Disapplied 2025 wrapper. |
c/misra/src/rules/RULE-15-5/FunctionReturnCondition.ql |
Reuses exit detection as legacy. |
c/misra/src/rules/RULE-1-2/LanguageExtensionsShouldNotBeUsed.ql |
Marks the extension wrapper as legacy. |
c/misra/src/rules/DIR-4-6/PlainNumericalTypeUsedOverExplicitTypedef.ql |
Reuses numerical-type detection as legacy. |
c/misra/src/rules/DIR-4-6/PlainIntegerTypeUsedOverExplicitTypedef.ql |
Adds the integer-only directive variant. |
c/misra/src/rules/DIR-1-2/LanguageExtensionsShouldBeMinimized.ql |
Adds the renumbered extension wrapper. |
c/misra/src/codingstandards/c/misra/SinglePointOfExit.qll |
Extracts reusable exit detection. |
c/misra/src/codingstandards/c/misra/ReservedMacroNames.qll |
Extracts reusable reserved-macro detection. |
c/misra/src/codingstandards/c/misra/PlainNumericalTypes.qll |
Shares type detection and floating-type filtering. |
c/misra/src/codeql-suites/misra-c-strict.qls |
Updates the suite description to 2025. |
c/misra/src/codeql-suites/misra-c-required.qls |
Excludes legacy Required wrappers. |
c/misra/src/codeql-suites/misra-c-mandatory.qls |
Excludes legacy Mandatory wrappers. |
c/misra/src/codeql-suites/misra-c-default.qls |
Switches default selection away from legacy wrappers. |
c/misra/src/codeql-suites/misra-c-audit.qls |
Updates the suite description to 2025. |
c/misra/src/codeql-suites/misra-c-advisory.qls |
Excludes legacy Advisory wrappers. |
c/misra/src/codeql-suites/misra-c-2023.qls |
Adds explicit older-edition selection. |
Review effort: Max (auto)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

Description
This PR updates the project to support the development of MISRA C:2025 queries while retaining support for older editions.
Seven different categories of guideline changes are identified. For each category, this PR provides one complete end-to-end implementation with tests.
The remaining guideline work is tracked in
rules-misra-c-2025.csv.Implemented Examples By Category
testreffiles.__assert_fail, using the standard-library model. Add tests for enabled assertions, NDEBUG-disabled assertions, and unrelated non-returning calls. Existing banned-function checks remain unchanged.static-parameter prohibition from current suites. Older suites retain the legacy prohibition.The supporting changes update the rule inventory, schema, generators, suites, documentation, release metadata handling, and validation scripts. Unchanged queries keep their existing standard metadata; only new or modified variants use
MISRA-C-2025.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?
🚨🚨🚨
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.
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.