Skip to content

Conversation

@knewbury01
Copy link
Collaborator

@knewbury01 knewbury01 commented Jan 15, 2026

Description

adds a package for linkage1 - contains 2 rules which are shared implementations

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-6-5-1
    • RULE-6-0-2
  • Queries have been modified for the following rules:
    • A3-3-1

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 15, 2026
Copilot AI review requested due to automatic review settings January 15, 2026 19:12
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 pull request adds a new "Linkage1" package containing shared implementations for two MISRA-C++-2023 rules (RULE-6-0-2 and RULE-6-5-1). These rules share implementation with existing AUTOSAR rules (A3-1-4 and A3-3-1). The PR refactors existing code to use shared query implementations, migrates tests to common locations, and updates metadata accordingly.

Changes:

  • Adds Linkage1 package with shared implementations for external linkage array size and declaration rules
  • Refactors AUTOSAR rules A3-1-4 and A3-3-1 to use shared implementations
  • Adds MISRA-C++-2023 rules RULE-6-0-2 and RULE-6-5-1 that reuse these shared implementations

Reviewed changes

Copilot reviewed 27 out of 30 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
rules.csv Updates package assignments for RULE-6-0-2 and RULE-6-5-1 to use new Linkage1 package
rule_packages/cpp/Scope.json Renames short_name to include "Autosar" suffix and adds shared_implementation_short_name
rule_packages/cpp/Linkage1.json New package definition for MISRA-C++-2023 linkage rules
rule_packages/cpp/Includes.json Adds shared_implementation_short_name to existing A3-3-1 rule
cpp/misra/test/rules/RULE-6-5-1/ExternalLinkageNotDeclaredInHeaderFileMisra.testref Test reference pointing to shared test implementation
cpp/misra/test/rules/RULE-6-0-2/ExternalLinkageArrayWithoutExplicitSizeMisra.testref Test reference pointing to shared test implementation
cpp/misra/src/rules/RULE-6-5-1/ExternalLinkageNotDeclaredInHeaderFileMisra.ql New MISRA query using shared implementation
cpp/misra/src/rules/RULE-6-0-2/ExternalLinkageArrayWithoutExplicitSizeMisra.ql New MISRA query using shared implementation
cpp/common/test/rules/externallinkagenotdeclaredinheaderfile/test.hpp Shared test header file
cpp/common/test/rules/externallinkagenotdeclaredinheaderfile/test.cpp Shared test implementation with COMPLIANT/NON_COMPLIANT cases
cpp/common/test/rules/externallinkagenotdeclaredinheaderfile/ExternalLinkageNotDeclaredInHeaderFile.ql Shared test query
cpp/common/test/rules/externallinkagenotdeclaredinheaderfile/ExternalLinkageNotDeclaredInHeaderFile.expected Expected test results
cpp/common/test/rules/externallinkagearraywithoutexplicitsize/test.cpp Shared test implementation with COMPLIANT/NON_COMPLIANT cases
cpp/common/test/rules/externallinkagearraywithoutexplicitsize/ExternalLinkageArrayWithoutExplicitSize.ql Shared test query
cpp/common/test/rules/externallinkagearraywithoutexplicitsize/ExternalLinkageArrayWithoutExplicitSize.expected Expected test results
cpp/common/src/codingstandards/cpp/rules/externallinkagenotdeclaredinheaderfile/ExternalLinkageNotDeclaredInHeaderFile.qll Shared implementation for external linkage declaration rule
cpp/common/src/codingstandards/cpp/rules/externallinkagearraywithoutexplicitsize/ExternalLinkageArrayWithoutExplicitSize.qll Shared implementation for array size rule
cpp/common/src/codingstandards/cpp/exclusions/cpp/Scope.qll Renames query to include "Autosar" suffix
cpp/common/src/codingstandards/cpp/exclusions/cpp/RuleMetadata.qll Imports and registers new Linkage1 package
cpp/common/src/codingstandards/cpp/exclusions/cpp/Linkage1.qll New exclusions file for Linkage1 package
cpp/autosar/test/rules/A3-3-1/ExternalLinkageNotDeclaredInHeaderFile.testref Updated to point to shared test
cpp/autosar/test/rules/A3-3-1/ExternalLinkageNotDeclaredInHeaderFile.qlref Removed (migrated to testref)
cpp/autosar/test/rules/A3-1-4/test.cpp Removed (migrated to common tests)
cpp/autosar/test/rules/A3-1-4/ExternalLinkageArrayWithoutExplicitSizeAutosar.testref Updated to point to shared test
cpp/autosar/test/rules/A3-1-4/ExternalLinkageArrayWithoutExplicitSize.qlref Removed (migrated to testref)
cpp/autosar/test/rules/A3-1-4/ExternalLinkageArrayWithoutExplicitSize.expected Removed (migrated to common tests)
cpp/autosar/src/rules/A3-3-1/ExternalLinkageNotDeclaredInHeaderFile.ql Refactored to use shared implementation
cpp/autosar/src/rules/A3-1-4/ExternalLinkageArrayWithoutExplicitSizeAutosar.ql New file using shared implementation (renamed)
cpp/autosar/src/rules/A3-1-4/ExternalLinkageArrayWithoutExplicitSize.ql Removed (renamed to ExternalLinkageArrayWithoutExplicitSizeAutosar.ql)
change_notes/2026-01-15-a3-1-4-extern-to-full.md Change note documenting the refactoring

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

Comment on lines +3 to +4
* Introducing a function or object with external linkage outside of a header file can
* cause developer confusion about its translation unit access semantics.
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

The documentation comment describes the wrong issue. This file is about arrays with external linkage declared without explicit size, but the comment describes "Introducing a function or object with external linkage outside of a header file" which is actually the description for the other rule (ExternalLinkageNotDeclaredInHeaderFile). The comment should describe the array size issue instead.

Suggested change
* Introducing a function or object with external linkage outside of a header file can
* cause developer confusion about its translation unit access semantics.
* Declaring an array with external linkage without explicitly specifying its size
* can lead to unclear or inconsistent expectations about the array's bounds.

Copilot uses AI. Check for mistakes.
"' with external linkage doesn't specify the size explicitly." and
hasExternalLinkage(v) and
not arrayType.hasArraySize() and
// Holds is if declEntry is an array variable declaration (not a definition)
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

Grammatical error: "Holds is if" should be "Holds if". Remove the word "is".

Suggested change
// Holds is if declEntry is an array variable declaration (not a definition)
// Holds if declEntry is an array variable declaration (not a definition)

Copilot uses AI. Check for mistakes.
@knewbury01 knewbury01 requested review from MichaelRFairhurst, jeongsoolee09, jketema and mbaluda and removed request for jketema January 15, 2026 19:16
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