misra: fix problems when executing premium addon

This commit is contained in:
Daniel Marjamäki 2022-05-05 14:15:09 +02:00
parent 843f7893d6
commit 9b807ba047
2 changed files with 5 additions and 4 deletions

View File

@ -10,6 +10,8 @@ import argparse
import json
import os
import sys
import subprocess
try:
import pathlib
except ImportError:
@ -1390,6 +1392,6 @@ def get_path_premium_addon():
def cmd_output(cmd):
try:
return subprocess.check_output([self.path_premium_addon, '--cli', '--get-rule-text=' + errorId]).strip().decode('ascii')
return subprocess.check_output(cmd).strip().decode('ascii')
except subprocess.CalledProcessError as e:
return e.output

View File

@ -25,7 +25,6 @@ import argparse
import codecs
import string
import copy
import subprocess
try:
from itertools import izip as zip
@ -4400,7 +4399,7 @@ class MisraChecker:
# Premium MISRA checking, deep analysis
if cfgNumber == 0 and self.path_premium_addon:
subprocess.cmd_output([self.path_premium_addon, '--cli', '--misra', dumpfile])
cppcheckdata.cmd_output([self.path_premium_addon, '--cli', '--misra', dumpfile])
def analyse_ctu_info(self, ctu_info_files):
all_typedef_info = []
@ -4665,7 +4664,7 @@ def main():
premium_command = [checker.path_premium_addon, '--misra', '--file-list', args.file_list]
if args.cli:
premium_command.append('--cli')
for line in subprocess.cmd_output(premium_command).split('\n'):
for line in cppcheckdata.cmd_output(premium_command).split('\n'):
if re.search(r'"errorId".*:.*"misra-', line) is not None:
print(line.strip())