Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6fda6fa
Add Banned8
jeongsoolee09 Mar 24, 2026
cd095be
Add Banned5
jeongsoolee09 Mar 24, 2026
e4b4e4b
Add Banned6 and improve `@description` metadata of A9-5-1
jeongsoolee09 Mar 24, 2026
25c9df8
Fix an editing mistake on rules.csv
jeongsoolee09 Mar 24, 2026
e682b81
Fix query formatting
jeongsoolee09 Mar 24, 2026
cfaccb3
Re-generate package files with new names and add shared test that was…
jeongsoolee09 Mar 24, 2026
52b590b
Fill in shared query file for BannedSyntax and Banned6
jeongsoolee09 Mar 24, 2026
895ffbb
Populate shared query for Banned5 / Representation and make shared te…
jeongsoolee09 Mar 24, 2026
a54f56d
Minor formatting
jeongsoolee09 Mar 24, 2026
e76a2d2
Fix query formatting
jeongsoolee09 Mar 24, 2026
5f0ad4d
Remove UnionKeywordUsed query and test
mbaluda Apr 2, 2026
a23f7a5
Merge branch 'main' into jeongsoolee09/MISRA-C++-2023-Banned856
mbaluda Apr 2, 2026
97b5fa5
remove bitFieldsShouldNotBeDeclaredQuery.ql
mbaluda Apr 2, 2026
6b86b72
Remove duplicate tests
mbaluda Apr 2, 2026
33e536d
Merge branch 'main' into jeongsoolee09/MISRA-C++-2023-Banned856
jeongsoolee09 Apr 6, 2026
67d06e9
Surround code bits with single-quotes
jeongsoolee09 Apr 9, 2026
b73fab8
Un-share `UnionKeywordUsed`
jeongsoolee09 Apr 9, 2026
5740aaa
Add `"readability"` tag to Banned8.json
jeongsoolee09 Apr 9, 2026
bf7a636
Shorten shared query name
jeongsoolee09 Apr 9, 2026
085033d
Update shared test query
jeongsoolee09 Apr 9, 2026
d4233c5
Fix formatting
jeongsoolee09 Apr 9, 2026
750cb2c
Add clickable links to the alert message
jeongsoolee09 Apr 9, 2026
a2d3c0e
Add change note for the breaking change
jeongsoolee09 Apr 9, 2026
febb828
Make the @tags property consistent
jeongsoolee09 Apr 9, 2026
97637a4
Merge branch 'main' into jeongsoolee09/MISRA-C++-2023-Banned856
jeongsoolee09 Apr 9, 2026
be70ae7
Update expected files of RULE-8-3-2
jeongsoolee09 Apr 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions cpp/autosar/src/rules/A9-5-1/UnionKeywordUsedAutosarCpp.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* @id cpp/autosar/union-keyword-used-autosar-cpp
* @name A9-5-1: Unions shall not be used
* @description Unions shall not be used. Tagged unions can be used if 'std::variant' is not
* available.
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

This PR replaces existing AUTOSAR queries (including changing/removing previous @ids) rather than only adding new queries. That changes the released artifacts layout, so a change note should be added under change_notes/ (per docs/development_handbook.md) and the PR checklist updated accordingly.

Copilot uses AI. Check for mistakes.
* @kind problem
* @precision very-high
* @problem.severity error
* @tags external/autosar/id/a9-5-1
* correctness
* scope/single-translation-unit
* external/autosar/allocated-target/implementation
* external/autosar/enforcement/automated
* external/autosar/obligation/required
*/

import cpp
import codingstandards.cpp.autosar
import codingstandards.cpp.rules.unionkeywordused.UnionKeywordUsed

module UnionKeywordUsedAutosarCppConfig implements UnionKeywordUsedConfigSig {
Query getQuery() { result = BannedSyntaxPackage::unionKeywordUsedAutosarCppQuery() }
}

import UnionKeywordUsed<UnionKeywordUsedAutosarCppConfig>
41 changes: 0 additions & 41 deletions cpp/autosar/src/rules/A9-5-1/UnionsUsed.ql

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* @id cpp/autosar/bit-fields-should-not-be-declared-autosar-cpp
* @name A9-6-2: Bit-fields shall be used only when interfacing to hardware or conforming to communication protocols
* @description The usage of bit-fields increases code complexity and certain aspects of bit-field
* manipulation can be error prone and implementation defined. Hence a bit-field usage
* is reserved only when interfacing to hardware or conformance to communication
* protocols.
* @kind problem
* @precision very-high
* @problem.severity recommendation
* @tags external/autosar/id/a9-6-2
* maintainability
* external/autosar/allocated-target/design
* external/autosar/enforcement/partially-automated
* external/autosar/obligation/required
*/

import cpp
import codingstandards.cpp.autosar
import codingstandards.cpp.rules.bitfieldsshallbeusedonlywheninterfacingtohardwareorconformingtocommunicationprotocols.BitFieldsShallBeUsedOnlyWhenInterfacingToHardwareOrConformingToCommunicationProtocols

module BitFieldsShouldNotBeDeclaredAutosarCppConfig implements
BitFieldsShallBeUsedOnlyWhenInterfacingToHardwareOrConformingToCommunicationProtocolsConfigSig
{
Query getQuery() { result = RepresentationPackage::bitFieldsShouldNotBeDeclaredAutosarCppQuery() }
}

import BitFieldsShallBeUsedOnlyWhenInterfacingToHardwareOrConformingToCommunicationProtocols<BitFieldsShouldNotBeDeclaredAutosarCppConfig>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cpp/common/test/rules/unionkeywordused/UnionKeywordUsed.ql
1 change: 1 addition & 0 deletions cpp/autosar/test/rules/A9-5-1/UnionsUsed.testref
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cpp/common/test/rules/unionkeywordused/UnionKeywordUsed.ql

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cpp/common/test/rules/bitfieldsshallbeusedonlywheninterfacingtohardwareorconformingtocommunicationprotocols/BitFieldsShallBeUsedOnlyWhenInterfacingToHardwareOrConformingToCommunicationProtocols.ql
Loading
Loading