misra: improved execution of premium addon

This commit is contained in:
Daniel Marjamäki 2022-03-16 18:16:46 +01:00
parent 40ff9edad6
commit fb89a2c742
1 changed files with 7 additions and 3 deletions

View File

@ -4067,7 +4067,10 @@ class MisraChecker:
cppcheck_severity = self.ruleTexts[ruleNum].cppcheck_severity cppcheck_severity = self.ruleTexts[ruleNum].cppcheck_severity
elif len(self.ruleTexts) == 0: elif len(self.ruleTexts) == 0:
if self.path_premium_addon: if self.path_premium_addon:
errmsg = subprocess.check_output([self.path_premium_addon, '--get-rule-text=' + errorId]).strip().decode('ascii') errmsg = ''
for line in subprocess.check_output([self.path_premium_addon, '--cli', '--get-rule-text=' + errorId]).strip().decode('ascii').split('\n'):
if not line.startswith('{'):
errmsg = line
else: else:
errmsg = 'misra violation (use --rule-texts=<file> to get proper output)' errmsg = 'misra violation (use --rule-texts=<file> to get proper output)'
else: else:
@ -4405,7 +4408,7 @@ class MisraChecker:
# Premium MISRA checking, deep analysis # Premium MISRA checking, deep analysis
if cfgNumber == 0 and self.path_premium_addon: if cfgNumber == 0 and self.path_premium_addon:
subprocess.call([self.path_premium_addon, '--misra', dumpfile]) subprocess.check_output([self.path_premium_addon, '--cli', '--misra', dumpfile])
def analyse_ctu_info(self, ctu_info_files): def analyse_ctu_info(self, ctu_info_files):
all_typedef_info = [] all_typedef_info = []
@ -4671,7 +4674,8 @@ def main():
if args.cli: if args.cli:
premium_command.append('--cli') premium_command.append('--cli')
for line in subprocess.check_output(premium_command).decode('ascii').split('\n'): for line in subprocess.check_output(premium_command).decode('ascii').split('\n'):
print(line.strip()) if re.search(r'"errorId".*:.*"misra-', line) is not None:
print(line.strip())
if settings.verify: if settings.verify:
sys.exit(exitCode) sys.exit(exitCode)