Skip to content

Commit 0deee2c

Browse files
committed
Support MISRA C++ 2023 in generation scripts
1 parent 56db222 commit 0deee2c

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

scripts/generate_rules/generate_package_description.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,24 @@ def generate_short_name(title):
110110
print("Error: " + standard + " " + rule_id + " is marked as part of package " + package_name + " but is not marked as supportable.")
111111
sys.exit(1)
112112

113+
tags = []
114+
113115
# Add the AUTOSAR obligation, enforcement and allocated target as query properties.
114116
properties = {}
115117
if obligation_level:
116118
properties["obligation"] = obligation_level.lower()
117119
if enforcement_level:
118120
properties["enforcement"] = enforcement_level.lower()
119121
if allocated_targets:
120-
properties["allocated-target"] = [target.strip(' ').lower() for target in allocated_targets.split("/")]
122+
if allocated_targets == "Single Translation Unit":
123+
# MISRA C++ 2023 uses the allocated targets field for scope
124+
tags.append("scope/single-translation-unit")
125+
elif allocated_targets == "System":
126+
# MISRA C++ 2023 uses the allocated targets field for scope
127+
tags.append("scope/system")
128+
else:
129+
properties["allocated-target"] = [target.strip(' ').lower() for target in allocated_targets.split("/")]
130+
121131
if difficulty == "Audit":
122132
properties["audit"] = ""
123133

@@ -164,7 +174,7 @@ def generate_short_name(title):
164174
"severity" : severity,
165175
"description" : description,
166176
"kind" : "problem",
167-
"tags" : []
177+
"tags" : tags
168178
}
169179
]
170180
}

scripts/generate_rules/generate_package_files.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,15 @@
5858
"MISRA-C-2012" : {
5959
"standard_title" : "MISRA-C:2012 Guidelines for the use of the C language in critical systems",
6060
"standard_url" : "https://www.misra.org.uk/"
61+
},
62+
"MISRA-C++-2023" : {
63+
"standard_title" : "MISRA C++:2023 Guidelines for the use C++:17 in critical systems",
64+
"standard_url" : "https://misra.org.uk/product/misra-cpp2023/"
6165
}
6266
}
6367

6468
# The help files of these standards cannot be distributed in our repository.
65-
external_help_file_standards = ["AUTOSAR", "MISRA-C-2012"]
69+
external_help_file_standards = ["AUTOSAR", "MISRA-C-2012", "MISRA-C++-2023"]
6670

6771
# Mapping from the QL language to source file extension used to generate a help example file.
6872
ql_language_ext_mappings = {

0 commit comments

Comments
 (0)