misra: fix problems when executing premium addon
This commit is contained in:
parent
843f7893d6
commit
9b807ba047
|
@ -10,6 +10,8 @@ import argparse
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import subprocess
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import pathlib
|
import pathlib
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -1390,6 +1392,6 @@ def get_path_premium_addon():
|
||||||
|
|
||||||
def cmd_output(cmd):
|
def cmd_output(cmd):
|
||||||
try:
|
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:
|
except subprocess.CalledProcessError as e:
|
||||||
return e.output
|
return e.output
|
||||||
|
|
|
@ -25,7 +25,6 @@ import argparse
|
||||||
import codecs
|
import codecs
|
||||||
import string
|
import string
|
||||||
import copy
|
import copy
|
||||||
import subprocess
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from itertools import izip as zip
|
from itertools import izip as zip
|
||||||
|
@ -4400,7 +4399,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.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):
|
def analyse_ctu_info(self, ctu_info_files):
|
||||||
all_typedef_info = []
|
all_typedef_info = []
|
||||||
|
@ -4665,7 +4664,7 @@ def main():
|
||||||
premium_command = [checker.path_premium_addon, '--misra', '--file-list', args.file_list]
|
premium_command = [checker.path_premium_addon, '--misra', '--file-list', args.file_list]
|
||||||
if args.cli:
|
if args.cli:
|
||||||
premium_command.append('--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:
|
if re.search(r'"errorId".*:.*"misra-', line) is not None:
|
||||||
print(line.strip())
|
print(line.strip())
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue