Skip to content

Conversation

@knewbury01
Copy link
Collaborator

@knewbury01 knewbury01 commented Jan 30, 2026

Description

please enter the description of your change here

Change request type

  • Release or process automation (GitHub workflows, internal scripts)
  • Internal documentation
  • External documentation
  • Query files (.ql, .qll, .qls or unit tests)
  • External scripts (analysis report or other code shipped as part of a release)

Rules with added or modified queries

  • No rules added
  • Queries have been added for the following rules:
    • RULE-5-0-1
  • Queries have been modified for the following rules:
    • rule number here

Release change checklist

A change note (development_handbook.md#change-notes) is required for any pull request which modifies:

  • The structure or layout of the release artifacts.
  • The evaluation performance (memory, execution time) of an existing query.
  • The results of an existing query in any circumstance.

If you are only adding new rule queries, a change note is not required.

Author: Is a change note required?

  • Yes
  • No

🚨🚨🚨
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.

  • Confirmed

Reviewer: Confirm that either a change note is not required or the change note is required and has been added.

  • Confirmed

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

  • Have all the relevant rule package description files been checked in?
  • Have you verified that the metadata properties of each new query is set appropriately?
  • Do all the unit tests contain both "COMPLIANT" and "NON_COMPLIANT" cases?
  • Are the alert messages properly formatted and consistent with the style guide?
  • Have you run the queries on OpenPilot and verified that the performance and results are acceptable?
    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.
  • Does the query have an appropriate level of in-query comments/documentation?
  • Have you considered/identified possible edge cases?
  • Does the query not reinvent features in the standard library?
  • Can the query be simplified further (not golfed!)

Reviewer

  • Have all the relevant rule package description files been checked in?
  • Have you verified that the metadata properties of each new query is set appropriately?
  • Do all the unit tests contain both "COMPLIANT" and "NON_COMPLIANT" cases?
  • Are the alert messages properly formatted and consistent with the style guide?
  • Have you run the queries on OpenPilot and verified that the performance and results are acceptable?
    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.
  • Does the query have an appropriate level of in-query comments/documentation?
  • Have you considered/identified possible edge cases?
  • Does the query not reinvent features in the standard library?
  • Can the query be simplified further (not golfed!)

@knewbury01 knewbury01 self-assigned this Jan 30, 2026
Copilot AI review requested due to automatic review settings January 30, 2026 21:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new MISRA C++ 2023 rule implementation for detecting trigraph-like sequences in C++ string literals (RULE-5-0-1), including metadata, exclusions wiring, and tests.

Changes:

  • Introduced a new rule package entry RULE-5-0-1 under MISRA-C++-2023 describing the trigraph-like sequence rule and its query metadata.
  • Implemented the TrigraphLikeSequencesShouldNotBeUsed CodeQL query for C++ string literals and wired it into the exclusions/RuleMetadata infrastructure and VS Code tasks.
  • Added unit tests (source, .qlref, .expected) for RULE-5-0-1 covering compliant, non-compliant, and documented false-positive scenarios.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
rule_packages/cpp/Trigraph.json Declares MISRA-C++-2023 rule RULE-5-0-1 with properties, query metadata, and implementation scope for trigraph-like sequences.
cpp/misra/test/rules/RULE-5-0-1/test.cpp Adds test cases for string literals containing each trigraph-like sequence plus compliant and COMPLIANT[FALSE_POSITIVE] examples.
cpp/misra/test/rules/RULE-5-0-1/TrigraphLikeSequencesShouldNotBeUsed.qlref Points the test harness at the new TrigraphLikeSequencesShouldNotBeUsed.ql query.
cpp/misra/test/rules/RULE-5-0-1/TrigraphLikeSequencesShouldNotBeUsed.expected Specifies the expected alerts for each non-compliant test case string literal.
cpp/misra/src/rules/RULE-5-0-1/TrigraphLikeSequencesShouldNotBeUsed.ql Implements the MISRA C++ RULE-5-0-1 query, scanning string literals for trigraph-like sequences while accounting for escaped ? characters and hooking into the MISRA exclusions mechanism.
cpp/common/src/codingstandards/cpp/exclusions/cpp/Trigraph.qll Adds the autogenerated TrigraphQuery type, metadata predicate, and TrigraphPackage::trigraphLikeSequencesShouldNotBeUsedQuery() to integrate the rule with the exclusions framework.
cpp/common/src/codingstandards/cpp/exclusions/cpp/RuleMetadata.qll Wires the new Trigraph package into the global TCPPQuery union and isQueryMetadata dispatcher so the rule participates in exclusions/metadata resolution.
.vscode/tasks.json Extends the rule_package_name picker options with Trigraph to support running/generating this package from VS Code tasks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

where
not isExcluded(s, TrigraphPackage::trigraphLikeSequencesShouldNotBeUsedQuery()) and
exists(s.getValue().regexpFind("\\?\\?[=/'()!<>-]", _, occurrenceOffset)) and
//one escape character is enough to mean this isnt a trigraph-like sequence
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment //one escape character is enough to mean this isnt a trigraph-like sequence contains a spelling/grammar issue; isnt should be written as isn't for clarity and consistency with surrounding documentation comments.

Suggested change
//one escape character is enough to mean this isnt a trigraph-like sequence
//one escape character is enough to mean this isn't a trigraph-like sequence

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant