From a7e901887098f5f518b6364846fc9c8889fe4ccd Mon Sep 17 00:00:00 2001 From: Paul Bartell Date: Tue, 9 Aug 2022 14:50:09 -0700 Subject: [PATCH 1/6] Add draft misra cppcheck wrapper script --- misra/misra_cppcheck.py | 314 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 314 insertions(+) create mode 100644 misra/misra_cppcheck.py diff --git a/misra/misra_cppcheck.py b/misra/misra_cppcheck.py new file mode 100644 index 00000000..6e01ba5f --- /dev/null +++ b/misra/misra_cppcheck.py @@ -0,0 +1,314 @@ +# FreeRTOS CI Tools +# Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# SPDX-License-Identifier: MIT +# +# Permission is hereby granted, free of charge, to any person obtaining a copy of +# this software and associated documentation files (the "Software"), to deal in +# the Software without restriction, including without limitation the rights to +# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +# the Software, and to permit persons to whom the Software is furnished to do so, +# subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# https://www.FreeRTOS.org +# https://github.com/FreeRTOS +# + +import argparse +import json +import logging +import os +import re +import subprocess +import sys +from dataclasses import dataclass +from glob import glob +from tempfile import mkstemp +from typing import Dict, List, Optional, Pattern, Set, TextIO +from xml.dom import minidom + + +@dataclass(frozen=True, eq=True) +class MisraDeviation: + rule_section: int + rule_num: int + file_path: Optional[str] + line_no: Optional[int] + + def __repr__(self): + if not self.file_path and not self.line_no: + str_value = "misra-c2012-{}.{}".format(self.rule_section, self.rule_num) + + elif self.file_path and self.line_no: + str_value = "misra-c2012-{}.{}:{}:{}".format( + self.rule_section, self.rule_num, self.file_path, self.line_no + ) + else: + str_value = None + return str_value + + +@dataclass(frozen=True, eq=True) +class CppcheckError: + error_id: str + file_path: str + line_no: int + message: Optional[str] + + def __repr__(self): + return "{}:{}: {}".format(self.file_path, self.line_no, self.error_id) + + +deviations_set: Set[MisraDeviation] = set() +deviations_map: Dict[str, MisraDeviation] = dict() +cc_error_list: List[CppcheckError] = list() + + +def cppcheck_do_misra(project_json_path: str, target_files_set: Set[str]): + args: List[str] = ["cppcheck"] + + fid, out_file = mkstemp() + os.close(fid) + + args.append("--project={}".format(project_json_path)) + args.append("--std=c89") + args.append("--enable=all") + args.append("--inconclusive") + args.append("--suppress=unusedFunction") + args.append("--xml") + args.append("--addon=misra") + args.append("--dump") + args.append("--output-file={}".format(out_file)) + for file in target_files_set: + args.append(file) + + logging.info("Calling: " + " ".join(args)) + subprocess.run(args) + return out_file + + +cov_exclusion_regex: Pattern = re.compile( + r"coverity\[misra_c_2012_rule_(\d{1,2})_(\d{1,2})_violation\]" +) +c_comment_token_regex: Pattern = re.compile(r"^\s*((\/\/)|(\/\*.*)|.*(\*\/))$") + + +def parse_inline_suppressions(file_path: str): + dump_file_path: str = file_path + ".dump" + + logging.info("Processing File: {}".format(dump_file_path)) + + doc = minidom.parse(dump_file_path) + + tokens = doc.documentElement.getElementsByTagName("tok") + # for token in tokens: + for i in range(len(tokens)): + token_str = tokens[i].getAttribute("str") + token = tokens[i] + # Only match exceptions for the file itself. + if token.getAttribute("fileIndex") == "0": + match = cov_exclusion_regex.search(token_str) + if match: + for j in range(i, len(tokens)): + token = tokens[j] + token_str = token.getAttribute("str") + # Skip tokens containing c comments (//, /*, */) or when determining line number + if c_comment_token_regex.search(token_str): + continue + else: + line_no = token.getAttribute("linenr") + deviation = MisraDeviation( + rule_section=int(match.group(1)), + rule_num=int(match.group(2)), + file_path=file_path, + line_no=int(line_no), + ) + + logging.info( + "Adding MISRA Rule {}.{} deviation at: {}:{} ".format( + deviation.rule_section, + deviation.rule_num, + deviation.file_path, + deviation.line_no, + ) + ) + deviations_map[str(deviation)] = deviation + break + + +# Coverity configs are in a variant of json which may include comments. +def parse_coverity_config(file_path: str): + config_regex = re.compile(r"deviation:\s*\"Rule\s*(\d{1,2}).(\d{1,2})\"") + with open(file_path, "r") as config_file: + for line in config_file.readlines(): + match = config_regex.search(line.strip()) + if match: + deviation = MisraDeviation( + rule_section=int(match.group(1)), + rule_num=int(match.group(2)), + file_path=None, + line_no=None, + ) + deviations_map[str(deviation)] = deviation + + +def filter_cppcheck_output( + base_directory: str, cppcheck_out_path: str, target_files_set: Set[str] +): + cc_out = minidom.parse(cppcheck_out_path) + cc_errors = cc_out.documentElement.getElementsByTagName("error") + for error in cc_errors: + locations = error.getElementsByTagName("location") + if len(locations): + file_path = os.path.relpath( + os.path.realpath(locations[0].getAttribute("file")), + start=base_directory, + ) + line_no = locations[0].getAttribute("line") + else: + file_path = "" + line_no = 0 + error_id = error.getAttribute("id") + + if "misra" in error_id: + message = None + else: + message = error.getAttribute("msg") + + if file_path not in target_files_set: + continue + + error_id_full = "{}:{}:{}".format(error_id, file_path, line_no) + + if error_id_full in deviations_map: + logging.info("Applying specific deviation for {}".format(error_id_full)) + elif error_id in deviations_map: + logging.info("Applying global deviation for {}".format(error_id_full)) + else: + error = CppcheckError( + error_id=error_id, file_path=file_path, line_no=line_no, message=message + ) + cc_error_list.append(error) + + +def main(): + parser = argparse.ArgumentParser( + "Parse c files for coverity-style inline exceptions. Also parse a coverify configuration file for global exclusions. Run cppcheck with the MISRA extension and filter the resulting misra warnings accordingly." + ) + parser.add_argument( + "-c", + "--coverity-config", + action="store", + help="coverity-format project configuration file", + default=None, + ) + parser.add_argument( + "-p", + "--compile-commands", + action="store", + help="Path to the cmake genrated compile_commands.json file", + default=None, + ) + parser.add_argument( + "-b", + "--base-directory", + action="store", + help="Base directory path (defaults to CWD).", + default=os.getcwd(), + ) + parser.add_argument( + "files", metavar="FILE", help="Target files to check (python regex)", nargs="+" + ) + + args = parser.parse_args() + + logging.basicConfig(level=logging.INFO) + + base_directory: str = os.path.realpath(args.base_directory) + + if not args.coverity_config or not os.path.exists(args.coverity_config): + logging.error( + "Configuration file: {} does not exist.".format(args.coverity_config) + ) + sys.exit(1) + + parse_coverity_config(args.coverity_config) + + if not args.compile_commands or not os.path.exists(args.compile_commands): + logging.error( + "Compile Commands file: {} does not exist.".format(args.compile_commands) + ) + sys.exit(1) + + target_files_set: Set[str] = set() + + if not args.files: + target_files_set.update( + glob(os.path.join(base_directory, "**"), recursive=True) + ) + else: + for file_glob in args.files: + file_list = glob(os.path.join(base_directory, file_glob), recursive=True) + if len(file_list) > 0: + for file_path in file_list: + target_files_set.add( + os.path.relpath( + os.path.realpath(file_path), start=base_directory + ) + ) + + cc_files_set: Set[str] = set() + with open(args.compile_commands, "r") as cc_file: + cc_contents = json.load(cc_file) + for target_f in cc_contents: + f_path: str = os.path.relpath( + os.path.realpath(target_f["file"]), start=base_directory + ) + cc_files_set.add(f_path) + + target_files_set = set.intersection(target_files_set, cc_files_set) + + # Run cppcheck with misra module + cc_out_file: str = cppcheck_do_misra(args.compile_commands, target_files_set) + + for target_file in target_files_set: + parse_inline_suppressions(target_file) + + # Parse cppcheck output file + filter_cppcheck_output(base_directory, cc_out_file, target_files_set) + + rule_text: Optional[Dict[str, str]] + if os.access("misra_rules.json", os.R_OK): + with open("misra_rules.json", "r") as file: + misra_json = json.load(file) + rule_text = dict() + for rule in misra_json: + rule_text[rule["id"]] = rule + + for error in cc_error_list: + if error.file_path in target_files_set: + print(error) + if rule_text and error.error_id in rule_text: + print( + "\t{}: {}".format( + rule_text[error.error_id]["category"], + rule_text[error.error_id]["description"], + ) + ) + else: + print("\t" + error.message) + print() + + +if __name__ == "__main__": + main() From 9a1e3850a11da1f8e9abc0e2bc917029b7f6bae2 Mon Sep 17 00:00:00 2001 From: Paul Bartell Date: Tue, 9 Aug 2022 15:44:26 -0700 Subject: [PATCH 2/6] Add misra rule text generation script --- misra/generate_misra_json.py | 281 +++++++++++++++++++++++++++++++++++ 1 file changed, 281 insertions(+) create mode 100644 misra/generate_misra_json.py diff --git a/misra/generate_misra_json.py b/misra/generate_misra_json.py new file mode 100644 index 00000000..b212b47b --- /dev/null +++ b/misra/generate_misra_json.py @@ -0,0 +1,281 @@ +# FreeRTOS CI Tools +# Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# SPDX-License-Identifier: MIT +# +# Permission is hereby granted, free of charge, to any person obtaining a copy of +# this software and associated documentation files (the "Software"), to deal in +# the Software without restriction, including without limitation the rights to +# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +# the Software, and to permit persons to whom the Software is furnished to do so, +# subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# https://www.FreeRTOS.org +# https://github.com/FreeRTOS +# + +import json +import os +import re +import zipfile +from typing import Dict, List, Pattern +from urllib import request + +misra_category_map: Dict[str, str] = { + "misra-c2012-d1.1": "Required", + "misra-c2012-d2.1": "Required", + "misra-c2012-d3.1": "Required", + "misra-c2012-d4.1": "Required", + "misra-c2012-d4.2": "Advisory", + "misra-c2012-d4.3": "Required", + "misra-c2012-d4.4": "Advisory", + "misra-c2012-d4.5": "Advisory", + "misra-c2012-d4.6": "Advisory", + "misra-c2012-d4.7": "Required", + "misra-c2012-d4.8": "Advisory", + "misra-c2012-d4.9": "Advisory", + "misra-c2012-d4.10": "Required", + "misra-c2012-d4.11": "Required", + "misra-c2012-d4.12": "Required", + "misra-c2012-d4.13": "Advisory", + "misra-c2012-d4.14": "Required", + "misra-c2012-1.1": "Required", + "misra-c2012-1.2": "Advisory", + "misra-c2012-1.3": "Required", + "misra-c2012-2.1": "Required", + "misra-c2012-2.2": "Required", + "misra-c2012-2.3": "Advisory", + "misra-c2012-2.4": "Advisory", + "misra-c2012-2.5": "Advisory", + "misra-c2012-2.6": "Advisory", + "misra-c2012-2.7": "Advisory", + "misra-c2012-3.1": "Required", + "misra-c2012-3.2": "Required", + "misra-c2012-4.1": "Required", + "misra-c2012-4.2": "Advisory", + "misra-c2012-5.1": "Required", + "misra-c2012-5.2": "Required", + "misra-c2012-5.3": "Required", + "misra-c2012-5.4": "Required", + "misra-c2012-5.5": "Required", + "misra-c2012-5.6": "Required", + "misra-c2012-5.7": "Required", + "misra-c2012-5.8": "Required", + "misra-c2012-5.9": "Advisory", + "misra-c2012-6.1": "Required", + "misra-c2012-6.2": "Required", + "misra-c2012-7.1": "Required", + "misra-c2012-7.2": "Required", + "misra-c2012-7.3": "Required", + "misra-c2012-7.4": "Required", + "misra-c2012-8.1": "Required", + "misra-c2012-8.2": "Required", + "misra-c2012-8.3": "Required", + "misra-c2012-8.4": "Required", + "misra-c2012-8.5": "Required", + "misra-c2012-8.6": "Required", + "misra-c2012-8.7": "Advisory", + "misra-c2012-8.8": "Required", + "misra-c2012-8.9": "Advisory", + "misra-c2012-8.10": "Required", + "misra-c2012-8.11": "Advisory", + "misra-c2012-8.12": "Required", + "misra-c2012-8.13": "Advisory", + "misra-c2012-8.14": "Required", + "misra-c2012-9.1": "Mandatory", + "misra-c2012-9.2": "Required", + "misra-c2012-9.3": "Required", + "misra-c2012-9.4": "Required", + "misra-c2012-9.5": "Required", + "misra-c2012-10.1": "Required", + "misra-c2012-10.2": "Required", + "misra-c2012-10.3": "Required", + "misra-c2012-10.4": "Required", + "misra-c2012-10.5": "Advisory", + "misra-c2012-10.6": "Required", + "misra-c2012-10.7": "Required", + "misra-c2012-10.8": "Required", + "misra-c2012-11.1": "Required", + "misra-c2012-11.2": "Required", + "misra-c2012-11.3": "Required", + "misra-c2012-11.4": "Advisory", + "misra-c2012-11.5": "Advisory", + "misra-c2012-11.6": "Required", + "misra-c2012-11.7": "Required", + "misra-c2012-11.8": "Required", + "misra-c2012-11.9": "Required", + "misra-c2012-12.1": "Advisory", + "misra-c2012-12.2": "Required", + "misra-c2012-12.3": "Advisory", + "misra-c2012-12.4": "Advisory", + "misra-c2012-12.5": "Mandatory", + "misra-c2012-13.1": "Required", + "misra-c2012-13.2": "Required", + "misra-c2012-13.3": "Advisory", + "misra-c2012-13.4": "Advisory", + "misra-c2012-13.5": "Required", + "misra-c2012-13.6": "Mandatory", + "misra-c2012-14.1": "Required", + "misra-c2012-14.2": "Required", + "misra-c2012-14.3": "Required", + "misra-c2012-14.4": "Required", + "misra-c2012-15.1": "Advisory", + "misra-c2012-15.2": "Required", + "misra-c2012-15.3": "Required", + "misra-c2012-15.4": "Advisory", + "misra-c2012-15.5": "Advisory", + "misra-c2012-15.6": "Required", + "misra-c2012-15.7": "Required", + "misra-c2012-16.1": "Required", + "misra-c2012-16.2": "Required", + "misra-c2012-16.3": "Required", + "misra-c2012-16.4": "Required", + "misra-c2012-16.5": "Required", + "misra-c2012-16.6": "Required", + "misra-c2012-16.7": "Required", + "misra-c2012-17.1": "Required", + "misra-c2012-17.2": "Required", + "misra-c2012-17.3": "Mandatory", + "misra-c2012-17.4": "Mandatory", + "misra-c2012-17.5": "Advisory", + "misra-c2012-17.6": "Mandatory", + "misra-c2012-17.7": "Required", + "misra-c2012-17.8": "Advisory", + "misra-c2012-18.1": "Required", + "misra-c2012-18.2": "Required", + "misra-c2012-18.3": "Required", + "misra-c2012-18.4": "Advisory", + "misra-c2012-18.5": "Advisory", + "misra-c2012-18.6": "Required", + "misra-c2012-18.7": "Required", + "misra-c2012-18.8": "Required", + "misra-c2012-19.1": "Mandatory", + "misra-c2012-19.2": "Advisory", + "misra-c2012-20.1": "Advisory", + "misra-c2012-20.2": "Required", + "misra-c2012-20.3": "Required", + "misra-c2012-20.4": "Required", + "misra-c2012-20.5": "Advisory", + "misra-c2012-20.6": "Required", + "misra-c2012-20.7": "Required", + "misra-c2012-20.8": "Required", + "misra-c2012-20.9": "Required", + "misra-c2012-20.10": "Advisory", + "misra-c2012-20.11": "Required", + "misra-c2012-20.12": "Required", + "misra-c2012-20.13": "Required", + "misra-c2012-20.14": "Required", + "misra-c2012-21.1": "Required", + "misra-c2012-21.2": "Required", + "misra-c2012-21.3": "Required", + "misra-c2012-21.4": "Required", + "misra-c2012-21.5": "Required", + "misra-c2012-21.6": "Required", + "misra-c2012-21.7": "Required", + "misra-c2012-21.8": "Required", + "misra-c2012-21.9": "Required", + "misra-c2012-21.10": "Required", + "misra-c2012-21.11": "Required", + "misra-c2012-21.12": "Advisory", + "misra-c2012-21.13": "Mandatory", + "misra-c2012-21.14": "Required", + "misra-c2012-21.15": "Required", + "misra-c2012-21.16": "Required", + "misra-c2012-21.17": "Mandatory", + "misra-c2012-21.18": "Mandatory", + "misra-c2012-21.19": "Mandatory", + "misra-c2012-21.20": "Mandatory", + "misra-c2012-22.1": "Required", + "misra-c2012-22.2": "Mandatory", + "misra-c2012-22.3": "Required", + "misra-c2012-22.4": "Mandatory", + "misra-c2012-22.5": "Mandatory", + "misra-c2012-22.6": "Mandatory", + "misra-c2012-22.7": "Required", + "misra-c2012-22.8": "Required", + "misra-c2012-22.9": "Required", + "misra-c2012-22.10": "Required", +} + +request.urlretrieve( + "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/archive/V2.1/Example-Suite-V2.1.zip", + "misra_test_suite.zip", +) + +file_path_regex: Pattern = re.compile( + r"misra_test_suite\.zip/Example-Suite-V2\.1/(D|R)_(\d{1,2})_(\d{1,2})\.c" +) + +misra_guideline_description_regex: Pattern = re.compile( + r"/\*\n\s+\*\s+(D|R)\.(\d\d?).(\d\d?)\n\s\*\n\s((?:\*.*\n\s)+)\*/" +) + +multiple_whitespace_regex: Pattern = re.compile(r"\s{2,}") + + +def cleanup_rule_text(rule_text: str): + # Remove * characters + rule_text = rule_text.replace("*", "") + + # Exclude everything after "Note: " + if "Note: " in rule_text: + rule_text = rule_text.split(" Note: ")[0] + + # Strip beginning and ending whitespace. + rule_text = rule_text.strip() + + # Combine multiple whitespace characters into a single space + rule_text = re.sub(multiple_whitespace_regex, " ", rule_text) + + # Add a period at the end of the text + rule_text = rule_text + "." + + return rule_text + + +with zipfile.ZipFile("misra_test_suite.zip", "r") as zip: + guidelines: List[Dict[str, str]] = list() + + for misra_test_file in zipfile.Path(zip, "Example-Suite-V2.1/").iterdir(): + match = file_path_regex.match(str(misra_test_file)) + if match: + with misra_test_file.open("r") as file: + f_contents: bytes = file.read() + match = misra_guideline_description_regex.search(f_contents) + + if match: + guideline: Dict[str, str] = dict() + if match[1] == "D": + guideline["id"] = "misra-c2012-d{}.{}".format( + int(match[2]), int(match[3]) + ) + guideline["type"] = "Directive" + elif match[1] == "R": + guideline["id"] = "misra-c2012-{}.{}".format( + int(match[2]), int(match[3]) + ) + guideline["type"] = "Rule" + else: + continue + + guideline["section"] = str(int(match[2], base=10)) + guideline["item"] = str(int(match[3], base=10)) + guideline["description"] = cleanup_rule_text(match[4]) + guideline["category"] = misra_category_map[guideline["id"]] + guidelines.append(guideline) + + with open("misra_rules.json", "w", encoding="utf-8") as output_f: + json.dump(guidelines, output_f, indent=4) + output_f.write(os.linesep) + +os.remove("misra_test_suite.zip") From 5b33434b2e183491a84187ee3e59094744e3fb0f Mon Sep 17 00:00:00 2001 From: Paul Bartell Date: Wed, 10 Aug 2022 12:57:20 -0700 Subject: [PATCH 3/6] Fix missing rules --- misra/generate_misra_json.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/misra/generate_misra_json.py b/misra/generate_misra_json.py index b212b47b..a6f8efca 100644 --- a/misra/generate_misra_json.py +++ b/misra/generate_misra_json.py @@ -213,7 +213,7 @@ ) file_path_regex: Pattern = re.compile( - r"misra_test_suite\.zip/Example-Suite-V2\.1/(D|R)_(\d{1,2})_(\d{1,2})\.c" + r"misra_test_suite\.zip/Example-Suite-V2\.1/(D|R)_(\d{1,2})_(\d{1,2})(?:_\d)?\.c" ) misra_guideline_description_regex: Pattern = re.compile( @@ -244,7 +244,7 @@ def cleanup_rule_text(rule_text: str): with zipfile.ZipFile("misra_test_suite.zip", "r") as zip: - guidelines: List[Dict[str, str]] = list() + guideline_map: Dict[str,Dict[str,str]] = dict() for misra_test_file in zipfile.Path(zip, "Example-Suite-V2.1/").iterdir(): match = file_path_regex.match(str(misra_test_file)) @@ -272,9 +272,11 @@ def cleanup_rule_text(rule_text: str): guideline["item"] = str(int(match[3], base=10)) guideline["description"] = cleanup_rule_text(match[4]) guideline["category"] = misra_category_map[guideline["id"]] - guidelines.append(guideline) + if guideline["id"] not in guideline_map: + guideline_map[guideline["id"]] = guideline with open("misra_rules.json", "w", encoding="utf-8") as output_f: + guidelines: List[Dict[str, str]] = list(guideline_map.values()) json.dump(guidelines, output_f, indent=4) output_f.write(os.linesep) From 370917e2cf794cac84e251682bffda21a6f64b13 Mon Sep 17 00:00:00 2001 From: Paul Bartell Date: Wed, 10 Aug 2022 12:57:49 -0700 Subject: [PATCH 4/6] Handle missing rule texts gracefully --- misra/misra_cppcheck.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/misra/misra_cppcheck.py b/misra/misra_cppcheck.py index 6e01ba5f..d0b1d0d3 100644 --- a/misra/misra_cppcheck.py +++ b/misra/misra_cppcheck.py @@ -298,14 +298,17 @@ def main(): for error in cc_error_list: if error.file_path in target_files_set: print(error) - if rule_text and error.error_id in rule_text: + text = None + if rule_text: + text = rule_text.get(error.error_id, None) + if text: print( "\t{}: {}".format( - rule_text[error.error_id]["category"], - rule_text[error.error_id]["description"], + text.get('category', "Unknown"), + text.get('description', 'Unknown'), ) ) - else: + elif error.message: print("\t" + error.message) print() From 2383a55a5486f507aa40f66e6f3c3f55d26417e5 Mon Sep 17 00:00:00 2001 From: Paul Bartell Date: Tue, 5 Dec 2023 14:56:01 -0800 Subject: [PATCH 5/6] Add github action yml start --- misra/action.yml | 73 ++ misra/misra_cppcheck.py | 53 +- misra/misra_rules_public.json | 1386 +++++++++++++++++++++++++++++++++ 3 files changed, 1494 insertions(+), 18 deletions(-) create mode 100644 misra/action.yml create mode 100644 misra/misra_rules_public.json diff --git a/misra/action.yml b/misra/action.yml new file mode 100644 index 00000000..75f89dea --- /dev/null +++ b/misra/action.yml @@ -0,0 +1,73 @@ +name: 'cppcheck' +description: 'cppcheck MISRA CI Check' +inputs: + path: + description: 'Path to repository folder to check with cppcheck.' + required: false + default: source/*.c + cmake-src-dir: + description: 'Path to repository folder which contains a CMakeLists.txt file.' + required: false + default: test/ + cmake-args: + description: 'Additional arguments to pass to cmake.' + required: false + +runs: + using: "composite" + steps: + - env: + bashPass: \033[32;1mPASSED - + bashInfo: \033[33;1mINFO - + bashFail: \033[31;1mFAILED - + bashEnd: \033[0m + stepName: Set-Up Cppcheck + name: ${{ env.stepName }} + id: spell-checker-setup + shell: bash + run: | + # ${{ env.stepName }} + echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" + set -e + + # Install the Dependencies we need to run the spell-checker + sudo apt-get update -y + sudo apt-get -y install cppcheck + + echo -e "::endgroup::" + # Only reach this line if no errors were hit above + echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" + + - env: + bashPass: \033[32;1mPASSED - + bashInfo: \033[33;1mINFO - + bashFail: \033[31;1mFAILED - + bashEnd: \033[0m + stepName: Spell Checker + name: ${{ env.stepName }} + id: run-spell-checker + working-directory: ${{ inputs.path }} + shell: bash + run: | + echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}" + + export PATH="$GITHUB_ACTION_PATH:$PATH" + export PATH="/usr/lib/x86_64-linux-gnu/cppcheck/addons:${PATH}" + exitStatus=0 + + cmake -B build -G Ninja -D CMAKE_EXPORT_COMPILE_COMMANDS=1 -S "${{ cmake-src-dir }}" + + python3 misra_cppcheck.py \ + --rule-text "${GITHUB_ACTION_PATH}/misra_rules_public.json" \ + --compile-commands build/compile_commands.json \ + "${{ inputs.path }}" + + exitStatus="$?" + + echo -e "::endgroup::" + if [ $exitStatus -eq 0 ]; then + echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}" + else + echo -e "${{ env.bashFail }} ${{ env.stepName }} ${{ env.bashEnd }}" + fi + exit $exitStatus diff --git a/misra/misra_cppcheck.py b/misra/misra_cppcheck.py index d0b1d0d3..4876b849 100644 --- a/misra/misra_cppcheck.py +++ b/misra/misra_cppcheck.py @@ -74,23 +74,26 @@ def __repr__(self): cc_error_list: List[CppcheckError] = list() -def cppcheck_do_misra(project_json_path: str, target_files_set: Set[str]): +def cppcheck_do_misra(project_json_path: Optional[str], target_files_set: Set[str]): args: List[str] = ["cppcheck"] fid, out_file = mkstemp() os.close(fid) - args.append("--project={}".format(project_json_path)) + if project_json_path: + args.append("--project={}".format(project_json_path)) args.append("--std=c89") args.append("--enable=all") args.append("--inconclusive") args.append("--suppress=unusedFunction") + args.append("--suppress=missingIncludeSystem") args.append("--xml") args.append("--addon=misra") args.append("--dump") args.append("--output-file={}".format(out_file)) - for file in target_files_set: - args.append(file) + if not project_json_path: + for file in target_files_set: + args.append(file) logging.info("Calling: " + " ".join(args)) subprocess.run(args) @@ -212,6 +215,13 @@ def main(): help="coverity-format project configuration file", default=None, ) + parser.add_argument( + "-r", + "--rule-text", + action="store", + help="Json format misra rule text", + default=None, + ) parser.add_argument( "-p", "--compile-commands", @@ -236,13 +246,14 @@ def main(): base_directory: str = os.path.realpath(args.base_directory) - if not args.coverity_config or not os.path.exists(args.coverity_config): - logging.error( - "Configuration file: {} does not exist.".format(args.coverity_config) - ) - sys.exit(1) - - parse_coverity_config(args.coverity_config) + if args.coverity_config: + if not os.path.exists(args.coverity_config): + logging.error( + "Configuration file: {} does not exist.".format(args.coverity_config) + ) + sys.exit(1) + else: + parse_coverity_config(args.coverity_config) if not args.compile_commands or not os.path.exists(args.compile_commands): logging.error( @@ -287,13 +298,19 @@ def main(): # Parse cppcheck output file filter_cppcheck_output(base_directory, cc_out_file, target_files_set) - rule_text: Optional[Dict[str, str]] - if os.access("misra_rules.json", os.R_OK): - with open("misra_rules.json", "r") as file: - misra_json = json.load(file) - rule_text = dict() - for rule in misra_json: - rule_text[rule["id"]] = rule + rule_text: Optional[Dict[str, str]] = None + if args.rule_text: + if not os.access(args.rule_text, os.R_OK): + logging.error( + "Rule text file: {} does not exist.".format(args.rule_text) + ) + sys.exit(1) + else: + with open(args.rule_text, "r") as file: + misra_json = json.load(file) + rule_text = dict() + for rule in misra_json: + rule_text[rule["id"]] = rule for error in cc_error_list: if error.file_path in target_files_set: diff --git a/misra/misra_rules_public.json b/misra/misra_rules_public.json new file mode 100644 index 00000000..dbe163db --- /dev/null +++ b/misra/misra_rules_public.json @@ -0,0 +1,1386 @@ +[ + { + "id": "misra-c2012-d1.1", + "type": "Directive", + "section": "1", + "item": "1", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/D_01_01.c", + "category": "Required" + }, + { + "id": "misra-c2012-d2.1", + "type": "Directive", + "section": "2", + "item": "1", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/D_02_01.c", + "category": "Required" + }, + { + "id": "misra-c2012-d3.1", + "type": "Directive", + "section": "3", + "item": "1", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/D_03_01.c", + "category": "Required" + }, + { + "id": "misra-c2012-d4.1", + "type": "Directive", + "section": "4", + "item": "1", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/D_04_01.c", + "category": "Required" + }, + { + "id": "misra-c2012-d4.2", + "type": "Directive", + "section": "4", + "item": "2", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/D_04_02.c", + "category": "Advisory" + }, + { + "id": "misra-c2012-d4.3", + "type": "Directive", + "section": "4", + "item": "3", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/D_04_03.c", + "category": "Required" + }, + { + "id": "misra-c2012-d4.4", + "type": "Directive", + "section": "4", + "item": "4", + "description": "https://sonarsource.github.io/rspec/#/rspec/S125/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-d4.5", + "type": "Directive", + "section": "4", + "item": "5", + "description": "https://sonarsource.github.io/rspec/#/rspec/S800/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-d4.6", + "type": "Directive", + "section": "4", + "item": "6", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/D_04_06.c", + "category": "Advisory" + }, + { + "id": "misra-c2012-d4.7", + "type": "Directive", + "section": "4", + "item": "7", + "description": "https://sonarsource.github.io/rspec/#/rspec/S899/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-d4.8", + "type": "Directive", + "section": "4", + "item": "8", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/D_04_08.c", + "category": "Required" + }, + { + "id": "misra-c2012-d4.9", + "type": "Directive", + "section": "4", + "item": "9", + "description": "https://sonarsource.github.io/rspec/#/rspec/S960/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-d4.10", + "type": "Directive", + "section": "4", + "item": "10", + "description": "https://sonarsource.github.io/rspec/#/rspec/S973/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-d4.11", + "type": "Directive", + "section": "4", + "item": "11", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/D_04_11.c", + "category": "Required" + }, + { + "id": "misra-c2012-d4.12", + "type": "Directive", + "section": "4", + "item": "12", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/D_04_12.c", + "category": "Required" + }, + { + "id": "misra-c2012-d4.13", + "type": "Directive", + "section": "4", + "item": "13", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/D_04_13.c", + "category": "Advisory" + }, + { + "id": "misra-c2012-d4.14", + "type": "Directive", + "section": "4", + "item": "14", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/D_04_14.c", + "category": "Required" + }, + { + "id": "misra-c2012-1.1", + "type": "Rule", + "section": "1", + "item": "1", + "description": "https://sonarsource.github.io/rspec/#/rspec/S779/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-1.2", + "type": "Rule", + "section": "1", + "item": "2", + "description": "https://sonarsource.github.io/rspec/#/rspec/S780/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-1.3", + "type": "Rule", + "section": "1", + "item": "3", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_01_03.c", + "category": "Required" + }, + { + "id": "misra-c2012-2.1", + "type": "Rule", + "section": "2", + "item": "1", + "description": "https://sonarsource.github.io/rspec/#/rspec/S1763/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-2.2", + "type": "Rule", + "section": "2", + "item": "2", + "description": "https://sonarsource.github.io/rspec/#/rspec/S901/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-2.3", + "type": "Rule", + "section": "2", + "item": "3", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_02_03.c", + "category": "Advisory" + }, + { + "id": "misra-c2012-2.4", + "type": "Rule", + "section": "2", + "item": "4", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_02_04.c", + "category": "Advisory" + }, + { + "id": "misra-c2012-2.5", + "type": "Rule", + "section": "2", + "item": "5", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_02_05.c", + "category": "Advisory" + }, + { + "id": "misra-c2012-2.6", + "type": "Rule", + "section": "2", + "item": "6", + "description": "https://sonarsource.github.io/rspec/#/rspec/S1065/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-2.7", + "type": "Rule", + "section": "2", + "item": "7", + "description": "https://sonarsource.github.io/rspec/#/rspec/S1172/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-3.1", + "type": "Rule", + "section": "3", + "item": "1", + "description": "https://sonarsource.github.io/rspec/#/rspec/S1103/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-3.2", + "type": "Rule", + "section": "3", + "item": "2", + "description": "https://sonarsource.github.io/rspec/#/rspec/S2323/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-4.1", + "type": "Rule", + "section": "4", + "item": "1", + "description": "https://sonarsource.github.io/rspec/#/rspec/S2335/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-4.2", + "type": "Rule", + "section": "4", + "item": "2", + "description": "https://sonarsource.github.io/rspec/#/rspec/S797/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-5.1", + "type": "Rule", + "section": "5", + "item": "1", + "description": "https://sonarsource.github.io/rspec/#/rspec/S799/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-5.2", + "type": "Rule", + "section": "5", + "item": "2", + "description": "https://sonarsource.github.io/rspec/#/rspec/S1117/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-5.3", + "type": "Rule", + "section": "5", + "item": "3", + "description": "https://sonarsource.github.io/rspec/#/rspec/S1117/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-5.4", + "type": "Rule", + "section": "5", + "item": "4", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_05_04.c", + "category": "Required" + }, + { + "id": "misra-c2012-5.5", + "type": "Rule", + "section": "5", + "item": "5", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_05_05.c", + "category": "Required" + }, + { + "id": "misra-c2012-5.6", + "type": "Rule", + "section": "5", + "item": "6", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_05_06.c", + "category": "Required" + }, + { + "id": "misra-c2012-5.7", + "type": "Rule", + "section": "5", + "item": "7", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_05_07.c", + "category": "Required" + }, + { + "id": "misra-c2012-5.8", + "type": "Rule", + "section": "5", + "item": "8", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_05_08.c", + "category": "Required" + }, + { + "id": "misra-c2012-5.9", + "type": "Rule", + "section": "5", + "item": "89", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_05_09.c", + "category": "Required" + }, + { + "id": "misra-c2012-6.1", + "type": "Rule", + "section": "6", + "item": "1", + "description": "https://sonarsource.github.io/rspec/#/rspec/S814/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-6.2", + "type": "Rule", + "section": "6", + "item": "2", + "description": "https://sonarsource.github.io/rspec/#/rspec/S2216/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-7.1", + "type": "Rule", + "section": "7", + "item": "1", + "description": "https://sonarsource.github.io/rspec/#/rspec/S1314/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-7.2", + "type": "Rule", + "section": "7", + "item": "2", + "description": "https://sonarsource.github.io/rspec/#/rspec/S854/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-7.3", + "type": "Rule", + "section": "7", + "item": "3", + "description": "https://sonarsource.github.io/rspec/#/rspec/S818/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-7.4", + "type": "Rule", + "section": "7", + "item": "4", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_07_04.c", + "category": "Required" + }, + { + "id": "misra-c2012-8.1", + "type": "Rule", + "section": "8", + "item": "1", + "description": "https://sonarsource.github.io/rspec/#/rspec/S820/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-8.2", + "type": "Rule", + "section": "8", + "item": "2", + "description": "https://sonarsource.github.io/rspec/#/rspec/S926/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-8.3", + "type": "Rule", + "section": "8", + "item": "3", + "description": "https://sonarsource.github.io/rspec/#/rspec/S927/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-8.4", + "type": "Rule", + "section": "8", + "item": "4", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_08_04.c", + "category": "Required" + }, + { + "id": "misra-c2012-8.5", + "type": "Rule", + "section": "8", + "item": "5", + "description": "https://sonarsource.github.io/rspec/#/rspec/S823/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-8.6", + "type": "Rule", + "section": "8", + "item": "6", + "description": "https://sonarsource.github.io/rspec/#/rspec/S828/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-8.7", + "type": "Rule", + "section": "8", + "item": "7", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_08_07.c", + "category": "Advisory" + }, + { + "id": "misra-c2012-8.8", + "type": "Rule", + "section": "8", + "item": "8", + "description": "https://sonarsource.github.io/rspec/#/rspec/S833/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-8.9", + "type": "Rule", + "section": "8", + "item": "9", + "description": "https://sonarsource.github.io/rspec/#/rspec/S825/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-8.10", + "type": "Rule", + "section": "8", + "item": "10", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_08_10.c", + "category": "Required" + }, + { + "id": "misra-c2012-8.11", + "type": "Rule", + "section": "8", + "item": "11", + "description": "https://sonarsource.github.io/rspec/#/rspec/S834/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-8.12", + "type": "Rule", + "section": "8", + "item": "12", + "description": "https://sonarsource.github.io/rspec/#/rspec/S2747/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-8.13", + "type": "Rule", + "section": "8", + "item": "13", + "description": "https://sonarsource.github.io/rspec/#/rspec/S5350/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-8.14", + "type": "Rule", + "section": "8", + "item": "14", + "description": "https://sonarsource.github.io/rspec/#/rspec/S1836/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-9.1", + "type": "Rule", + "section": "9", + "item": "1", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_09_01.c", + "category": "Mandatory" + }, + { + "id": "misra-c2012-9.2", + "type": "Rule", + "section": "9", + "item": "2", + "description": "https://sonarsource.github.io/rspec/#/rspec/S835/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-9.3", + "type": "Rule", + "section": "9", + "item": "3", + "description": "https://sonarsource.github.io/rspec/#/rspec/S835/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-9.4", + "type": "Rule", + "section": "9", + "item": "4", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_09_04.c", + "category": "Required" + }, + { + "id": "misra-c2012-9.5", + "type": "Rule", + "section": "9", + "item": "5", + "description": "https://sonarsource.github.io/rspec/#/rspec/S834/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-10.1", + "type": "Rule", + "section": "10", + "item": "1", + "description": "https://sonarsource.github.io/rspec/#/rspec/S874/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-10.2", + "type": "Rule", + "section": "10", + "item": "2", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_10_02.c", + "category": "Required" + }, + { + "id": "misra-c2012-10.3", + "type": "Rule", + "section": "10", + "item": "3", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_10_03.c", + "category": "Required" + }, + { + "id": "misra-c2012-10.4", + "type": "Rule", + "section": "10", + "item": "4", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_10_04.c", + "category": "Required" + }, + { + "id": "misra-c2012-10.5", + "type": "Rule", + "section": "10", + "item": "5", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_10_05.c", + "category": "Advisory" + }, + { + "id": "misra-c2012-10.6", + "type": "Rule", + "section": "10", + "item": "6", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_10_06.c", + "category": "Required" + }, + { + "id": "misra-c2012-10.7", + "type": "Rule", + "section": "10", + "item": "7", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_10_07.c", + "category": "Required" + }, + { + "id": "misra-c2012-10.8", + "type": "Rule", + "section": "10", + "item": "8", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_10_08.c", + "category": "Required" + }, + { + "id": "misra-c2012-11.1", + "type": "Rule", + "section": "11", + "item": "1", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_11_01.c", + "category": "Required" + }, + { + "id": "misra-c2012-11.2", + "type": "Rule", + "section": "11", + "item": "2", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_11_02.c", + "category": "Required" + }, + { + "id": "misra-c2012-11.3", + "type": "Rule", + "section": "11", + "item": "3", + "description": "https://sonarsource.github.io/rspec/#/rspec/S856/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-11.4", + "type": "Rule", + "section": "11", + "item": "4", + "description": "https://sonarsource.github.io/rspec/#/rspec/S1767/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-11.5", + "type": "Rule", + "section": "11", + "item": "5", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_11_05.c", + "category": "Advisory" + }, + { + "id": "misra-c2012-11.6", + "type": "Rule", + "section": "11", + "item": "6", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_11_06.c", + "category": "Required" + }, + { + "id": "misra-c2012-11.7", + "type": "Rule", + "section": "11", + "item": "7", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_11_07.c", + "category": "Required" + }, + { + "id": "misra-c2012-11.8", + "type": "Rule", + "section": "11", + "item": "8", + "description": "https://sonarsource.github.io/rspec/#/rspec/S859/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-11.9", + "type": "Rule", + "section": "11", + "item": "9", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_11_09.c", + "category": "Required" + }, + { + "id": "misra-c2012-12.1", + "type": "Rule", + "section": "12", + "item": "1", + "description": "https://sonarsource.github.io/rspec/#/rspec/S1987/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-12.2", + "type": "Rule", + "section": "12", + "item": "2", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_12_02.c", + "category": "Required" + }, + { + "id": "misra-c2012-12.3", + "type": "Rule", + "section": "12", + "item": "3", + "description": "https://sonarsource.github.io/rspec/#/rspec/S878/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-12.4", + "type": "Rule", + "section": "12", + "item": "4", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_12_04.c", + "category": "Advisory" + }, + { + "id": "misra-c2012-12.5", + "type": "Rule", + "section": "12", + "item": "5", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_12_05.c", + "category": "Mandatory" + }, + { + "id": "misra-c2012-13.1", + "type": "Rule", + "section": "13", + "item": "1", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_13_01_1.c", + "category": "Required" + }, + { + "id": "misra-c2012-13.2", + "type": "Rule", + "section": "13", + "item": "2", + "description": "https://sonarsource.github.io/rspec/#/rspec/S1987/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-13.3", + "type": "Rule", + "section": "13", + "item": "3", + "description": "https://sonarsource.github.io/rspec/#/rspec/S1987/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-13.4", + "type": "Rule", + "section": "13", + "item": "4", + "description": "https://sonarsource.github.io/rspec/#/rspec/S1121/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-13.5", + "type": "Rule", + "section": "13", + "item": "5", + "description": "https://sonarsource.github.io/rspec/#/rspec/S912/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-13.6", + "type": "Rule", + "section": "13", + "item": "6", + "description": "https://sonarsource.github.io/rspec/#/rspec/S922/cfamilyy", + "category": "Mandatory" + }, + { + "id": "misra-c2012-14.1", + "type": "Rule", + "section": "14", + "item": "1", + "description": "https://sonarsource.github.io/rspec/#/rspec/S2193/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-14.2", + "type": "Rule", + "section": "14", + "item": "2", + "description": "https://sonarsource.github.io/rspec/#/rspec/S886/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-14.3", + "type": "Rule", + "section": "14", + "item": "3", + "description": "https://sonarsource.github.io/rspec/#/rspec/S2583/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-14.4", + "type": "Rule", + "section": "14", + "item": "4", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_14_04.c", + "category": "Required" + }, + { + "id": "misra-c2012-15.1", + "type": "Rule", + "section": "15", + "item": "1", + "description": "https://sonarsource.github.io/rspec/#/rspec/S907/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-15.2", + "type": "Rule", + "section": "15", + "item": "2", + "description": "https://sonarsource.github.io/rspec/#/rspec/S999/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-15.3", + "type": "Rule", + "section": "15", + "item": "3", + "description": "https://sonarsource.github.io/rspec/#/rspec/S1909/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-15.4", + "type": "Rule", + "section": "15", + "item": "4", + "description": "https://sonarsource.github.io/rspec/#/rspec/S924/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-15.5", + "type": "Rule", + "section": "15", + "item": "5", + "description": "https://sonarsource.github.io/rspec/#/rspec/S1005/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-15.6", + "type": "Rule", + "section": "15", + "item": "6", + "description": "https://sonarsource.github.io/rspec/#/rspec/S121/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-15.7", + "type": "Rule", + "section": "15", + "item": "7", + "description": "https://sonarsource.github.io/rspec/#/rspec/S126/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-16.1", + "type": "Rule", + "section": "16", + "item": "1", + "description": "https://sonarsource.github.io/rspec/#/rspec/S1219/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-16.2", + "type": "Rule", + "section": "16", + "item": "2", + "description": "https://sonarsource.github.io/rspec/#/rspec/S916/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-16.3", + "type": "Rule", + "section": "16", + "item": "3", + "description": "https://sonarsource.github.io/rspec/#/rspec/S128/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-16.4", + "type": "Rule", + "section": "16", + "item": "4", + "description": "https://sonarsource.github.io/rspec/#/rspec/S131/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-16.5", + "type": "Rule", + "section": "16", + "item": "5", + "description": "https://sonarsource.github.io/rspec/#/rspec/S131/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-16.6", + "type": "Rule", + "section": "16", + "item": "6", + "description": "https://sonarsource.github.io/rspec/#/rspec/S1301/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-16.7", + "type": "Rule", + "section": "16", + "item": "7", + "description": "https://sonarsource.github.io/rspec/#/rspec/S920/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-17.1", + "type": "Rule", + "section": "17", + "item": "1", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_17_01.c", + "category": "Required" + }, + { + "id": "misra-c2012-17.2", + "type": "Rule", + "section": "17", + "item": "2", + "description": "https://sonarsource.github.io/rspec/#/rspec/S925/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-17.3", + "type": "Rule", + "section": "17", + "item": "3", + "description": "https://sonarsource.github.io/rspec/#/rspec/S819/cfamily", + "category": "Mandatory" + }, + { + "id": "misra-c2012-17.4", + "type": "Rule", + "section": "17", + "item": "4", + "description": "https://sonarsource.github.io/rspec/#/rspec/S935/cfamily", + "category": "Mandatory" + }, + { + "id": "misra-c2012-17.5", + "type": "Rule", + "section": "17", + "item": "5", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_17_05.c", + "category": "Advisory" + }, + { + "id": "misra-c2012-17.6", + "type": "Rule", + "section": "17", + "item": "6", + "description": "https://sonarsource.github.io/rspec/#/rspec/S1831/cfamily", + "category": "Mandatory" + }, + { + "id": "misra-c2012-17.7", + "type": "Rule", + "section": "17", + "item": "7", + "description": "https://sonarsource.github.io/rspec/#/rspec/S2201/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-17.8", + "type": "Rule", + "section": "17", + "item": "8", + "description": "https://sonarsource.github.io/rspec/#/rspec/S1226/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-18.1", + "type": "Rule", + "section": "18", + "item": "1", + "description": "https://sonarsource.github.io/rspec/#/rspec/S941/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-18.2", + "type": "Rule", + "section": "18", + "item": "2", + "description": "https://sonarsource.github.io/rspec/#/rspec/S941/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-18.3", + "type": "Rule", + "section": "18", + "item": "3", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_18_03.c", + "category": "Required" + }, + { + "id": "misra-c2012-18.4", + "type": "Rule", + "section": "18", + "item": "4", + "description": "https://sonarsource.github.io/rspec/#/rspec/S941/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-18.5", + "type": "Rule", + "section": "18", + "item": "5", + "description": "https://sonarsource.github.io/rspec/#/rspec/S943/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-18.6", + "type": "Rule", + "section": "18", + "item": "7", + "description": "https://sonarsource.github.io/rspec/#/rspec/S946/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-18.7", + "type": "Rule", + "section": "18", + "item": "7", + "description": "https://sonarsource.github.io/rspec/#/rspec/S2324/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-18.8", + "type": "Rule", + "section": "18", + "item": "8", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_18_08.c", + "category": "Required" + }, + { + "id": "misra-c2012-19.1", + "type": "Rule", + "section": "19", + "item": "1", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_19_01.c", + "category": "Mandatory" + }, + { + "id": "misra-c2012-19.2", + "type": "Rule", + "section": "19", + "item": "2", + "description": "https://sonarsource.github.io/rspec/#/rspec/S953/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-20.1", + "type": "Rule", + "section": "20", + "item": "1", + "description": "https://sonarsource.github.io/rspec/#/rspec/S954/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-20.2", + "type": "Rule", + "section": "20", + "item": "2", + "description": "https://sonarsource.github.io/rspec/#/rspec/S955/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-20.3", + "type": "Rule", + "section": "20", + "item": "3", + "description": "https://sonarsource.github.io/rspec/#/rspec/S956/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-20.4", + "type": "Rule", + "section": "20", + "item": "4", + "description": "https://sonarsource.github.io/rspec/#/rspec/S5266/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-20.5", + "type": "Rule", + "section": "20", + "item": "5", + "description": "https://sonarsource.github.io/rspec/#/rspec/S959/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-20.6", + "type": "Rule", + "section": "20", + "item": "6", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_20_06.c", + "category": "Required" + }, + { + "id": "misra-c2012-20.7", + "type": "Rule", + "section": "20", + "item": "7", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_20_07.c", + "category": "Required" + }, + { + "id": "misra-c2012-20.8", + "type": "Rule", + "section": "20", + "item": "8", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_20_08.c", + "category": "Required" + }, + { + "id": "misra-c2012-20.9", + "type": "Rule", + "section": "20", + "item": "9", + "description": "https://sonarsource.github.io/rspec/#/rspec/S966/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-20.10", + "type": "Rule", + "section": "20", + "item": "10", + "description": "https://sonarsource.github.io/rspec/#/rspec/S968/cfamily", + "category": "Advisory" + }, + { + "id": "misra-c2012-20.11", + "type": "Rule", + "section": "20", + "item": "11", + "description": "https://sonarsource.github.io/rspec/#/rspec/S967/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-20.12", + "type": "Rule", + "section": "20", + "item": "12", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_20_12.c", + "category": "Required" + }, + { + "id": "misra-c2012-20.13", + "type": "Rule", + "section": "20", + "item": "13", + "description": "https://sonarsource.github.io/rspec/#/rspec/S977/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-20.14", + "type": "Rule", + "section": "20", + "item": "14", + "description": "https://sonarsource.github.io/rspec/#/rspec/S970/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-21.1", + "type": "Rule", + "section": "21", + "item": "1", + "description": "https://sonarsource.github.io/rspec/#/rspec/S1761/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-21.2", + "type": "Rule", + "section": "21", + "item": "2", + "description": "https://sonarsource.github.io/rspec/#/rspec/S978/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-21.3", + "type": "Rule", + "section": "21", + "item": "3", + "description": "https://sonarsource.github.io/rspec/#/rspec/S984/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-21.4", + "type": "Rule", + "section": "21", + "item": "4", + "description": "https://sonarsource.github.io/rspec/#/rspec/S982/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-21.5", + "type": "Rule", + "section": "21", + "item": "5", + "description": "https://sonarsource.github.io/rspec/#/rspec/S987/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-21.6", + "type": "Rule", + "section": "21", + "item": "6", + "description": "https://sonarsource.github.io/rspec/#/rspec/S988/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-21.7", + "type": "Rule", + "section": "21", + "item": "7", + "description": "https://sonarsource.github.io/rspec/#/rspec/S989/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-21.8", + "type": "Rule", + "section": "21", + "item": "8", + "description": "https://sonarsource.github.io/rspec/#/rspec/S990/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-21.9", + "type": "Rule", + "section": "21", + "item": "9", + "description": "https://sonarsource.github.io/rspec/#/rspec/S2393/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-21.10", + "type": "Rule", + "section": "21", + "item": "10", + "description": "https://sonarsource.github.io/rspec/#/rspec/S991/cfamily", + "category": "Required" + }, + { + "id": "misra-c2012-21.11", + "type": "Rule", + "section": "21", + "item": "11", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_21_11.c", + "category": "Required" + }, + { + "id": "misra-c2012-21.12", + "type": "Rule", + "section": "21", + "item": "12", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_21_12.c", + "category": "Advisory" + }, + { + "id": "misra-c2012-21.13", + "type": "Rule", + "section": "21", + "item": "13", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_21_13.c", + "category": "Mandatory" + }, + { + "id": "misra-c2012-21.14", + "type": "Rule", + "section": "21", + "item": "14", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_21_14.c", + "category": "Required" + }, + { + "id": "misra-c2012-21.15", + "type": "Rule", + "section": "21", + "item": "15", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_21_15.c", + "category": "Required" + }, + { + "id": "misra-c2012-21.16", + "type": "Rule", + "section": "21", + "item": "16", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_21_16.c", + "category": "Required" + }, + { + "id": "misra-c2012-21.17", + "type": "Rule", + "section": "21", + "item": "17", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_21_17.c", + "category": "Mandatory" + }, + { + "id": "misra-c2012-21.18", + "type": "Rule", + "section": "21", + "item": "18", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_21_18.c", + "category": "Mandatory" + }, + { + "id": "misra-c2012-21.19", + "type": "Rule", + "section": "21", + "item": "19", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_21_19.c", + "category": "Mandatory" + }, + { + "id": "misra-c2012-21.20", + "type": "Rule", + "section": "21", + "item": "20", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_21_20.c", + "category": "Mandatory" + }, + { + "id": "misra-c2012-22.1", + "type": "Rule", + "section": "22", + "item": "1", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_22_01.c", + "category": "Required" + }, + { + "id": "misra-c2012-22.2", + "type": "Rule", + "section": "22", + "item": "2", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_22_02.c", + "category": "Mandatory" + }, + { + "id": "misra-c2012-22.3", + "type": "Rule", + "section": "22", + "item": "3", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_22_03.c", + "category": "Required" + }, + { + "id": "misra-c2012-22.4", + "type": "Rule", + "section": "22", + "item": "4", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_22_04.c", + "category": "Mandatory" + }, + { + "id": "misra-c2012-22.5", + "type": "Rule", + "section": "22", + "item": "5", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_22_05.c", + "category": "Mandatory" + }, + { + "id": "misra-c2012-22.6", + "type": "Rule", + "section": "22", + "item": "6", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_22_06.c", + "category": "Mandatory" + }, + { + "id": "misra-c2012-22.7", + "type": "Rule", + "section": "22", + "item": "7", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_22_07.c", + "category": "Required" + }, + { + "id": "misra-c2012-22.8", + "type": "Rule", + "section": "22", + "item": "8", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_22_08.c", + "category": "Required" + }, + { + "id": "misra-c2012-22.9", + "type": "Rule", + "section": "22", + "item": "9", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_22_09.c", + "category": "Required" + }, + { + "id": "misra-c2012-22.10", + "type": "Rule", + "section": "22", + "item": "10", + "description": "https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/raw/master/R_22_10.c", + "category": "Required" + } +] From 3a68922693ea2bbda9188ca686059e13744c926b Mon Sep 17 00:00:00 2001 From: Paul Bartell Date: Tue, 5 Dec 2023 15:12:58 -0800 Subject: [PATCH 6/6] Relocate --- {misra => misra-cppcheck}/action.yml | 2 +- {misra => misra-cppcheck}/generate_misra_json.py | 0 {misra => misra-cppcheck}/misra_cppcheck.py | 0 {misra => misra-cppcheck}/misra_rules_public.json | 0 4 files changed, 1 insertion(+), 1 deletion(-) rename {misra => misra-cppcheck}/action.yml (98%) rename {misra => misra-cppcheck}/generate_misra_json.py (100%) rename {misra => misra-cppcheck}/misra_cppcheck.py (100%) rename {misra => misra-cppcheck}/misra_rules_public.json (100%) diff --git a/misra/action.yml b/misra-cppcheck/action.yml similarity index 98% rename from misra/action.yml rename to misra-cppcheck/action.yml index 75f89dea..68139bb0 100644 --- a/misra/action.yml +++ b/misra-cppcheck/action.yml @@ -1,4 +1,4 @@ -name: 'cppcheck' +name: 'misra-cppcheck' description: 'cppcheck MISRA CI Check' inputs: path: diff --git a/misra/generate_misra_json.py b/misra-cppcheck/generate_misra_json.py similarity index 100% rename from misra/generate_misra_json.py rename to misra-cppcheck/generate_misra_json.py diff --git a/misra/misra_cppcheck.py b/misra-cppcheck/misra_cppcheck.py similarity index 100% rename from misra/misra_cppcheck.py rename to misra-cppcheck/misra_cppcheck.py diff --git a/misra/misra_rules_public.json b/misra-cppcheck/misra_rules_public.json similarity index 100% rename from misra/misra_rules_public.json rename to misra-cppcheck/misra_rules_public.json