Revert "misra,cert: use premiumaddon if it exists"

This reverts commit ef28c579bf.
This commit is contained in:
Daniel Marjamäki 2022-02-23 22:38:41 +01:00
parent f68b219300
commit 3dd200930a
3 changed files with 9 additions and 30 deletions

View File

@ -13,7 +13,6 @@ import argparse
import cppcheckdata
import sys
import re
import subprocess
VERIFY = ('-verify' in sys.argv)
VERIFY_EXPECTED = []
@ -402,8 +401,6 @@ if __name__ == '__main__':
parser = get_args_parser()
args = parser.parse_args()
path_premium_addon = cppcheckdata.get_path_premium_addon()
if args.verify:
VERIFY = True
@ -416,14 +413,6 @@ if __name__ == '__main__':
if not args.quiet:
print('Checking %s...' % dumpfile)
if path_premium_addon:
premium_command = [path_premium_addon, '--cert', dumpfile]
if args.cli:
premium_command.append('--cli')
for line in subprocess.check_output(premium_command).decode('ascii').split('\n'):
if line.find('cert-') > 0:
print(line.strip())
data = cppcheckdata.CppcheckData(dumpfile)
if VERIFY:

View File

@ -8,8 +8,6 @@ License: No restrictions, use this as you need.
import argparse
import json
import os
import pathlib
import sys
from xml.etree import ElementTree
@ -1366,12 +1364,3 @@ def reportSummary(dumpfile, summary_type, summary_data):
with open(ctu_info_file, 'at') as f:
msg = {'summary': summary_type, 'data': summary_data}
f.write(json.dumps(msg) + '\n')
def get_path_premium_addon():
p = pathlib.Path(sys.argv[0]).parent.parent
p1 = os.path.join(p, 'premiumaddon')
p2 = os.path.join(p, 'cppcheck')
if os.path.isfile(p1) and os.path.isfile(p2):
return p1
return None

View File

@ -1318,7 +1318,7 @@ class MisraChecker:
self._ctu_summary_identifiers = False
self._ctu_summary_usage = False
self.path_premium_addon = None
self.premium_addon = None
def __repr__(self):
attrs = ["settings", "verify_expected", "verify_actual", "violations",
@ -4048,8 +4048,8 @@ class MisraChecker:
misra_severity = self.ruleTexts[ruleNum].misra_severity
cppcheck_severity = self.ruleTexts[ruleNum].cppcheck_severity
elif len(self.ruleTexts) == 0:
if self.path_premium_addon:
errmsg = subprocess.check_output([self.path_premium_addon, '--get-rule-text=' + errorId]).strip().decode('ascii')
if self.premium_addon:
errmsg = subprocess.check_output([self.premium_addon, '--get-rule-text=' + errorId]).strip().decode('ascii')
else:
errmsg = 'misra violation (use --rule-texts=<file> to get proper output)'
else:
@ -4386,8 +4386,8 @@ class MisraChecker:
self.executeCheck(2210, self.misra_22_10, cfg)
# Premium MISRA checking, deep analysis
if cfgNumber == 0 and self.path_premium_addon:
subprocess.call([self.path_premium_addon, '--misra', dumpfile])
if cfgNumber == 0 and self.premium_addon:
subprocess.call([self.premium_addon, '--misra', dumpfile])
def analyse_ctu_info(self, ctu_info_files):
all_typedef_info = []
@ -4572,6 +4572,7 @@ def get_args_parser():
parser.add_argument("-generate-table", help=argparse.SUPPRESS, action="store_true")
parser.add_argument("-verify", help=argparse.SUPPRESS, action="store_true")
parser.add_argument("--severity", type=str, help="Set a custom severity string, for example 'error' or 'warning'. ")
parser.add_argument("--premium-addon", type=str, default=None, help=argparse.SUPPRESS)
return parser
@ -4581,7 +4582,7 @@ def main():
settings = MisraSettings(args)
checker = MisraChecker(settings)
checker.path_premium_addon = cppcheckdata.get_path_premium_addon()
checker.premium_addon = args.premium_addon
if args.generate_table:
generateTable()
@ -4644,8 +4645,8 @@ def main():
checker.analyse_ctu_info(ctu_info_files)
if args.file_list and checker.path_premium_addon:
premium_command = [checker.path_premium_addon, '--misra', '--file-list', args.file_list]
if args.file_list and args.premium_addon:
premium_command = [args.premium_addon, '--misra', '--file-list', args.file_list]
if args.cli:
premium_command.append('--cli')
for line in subprocess.check_output(premium_command).decode('ascii').split('\n'):