diff --git a/diff_cover/command_runner.py b/diff_cover/command_runner.py index 2bad10c8..0aa19cd3 100644 --- a/diff_cover/command_runner.py +++ b/diff_cover/command_runner.py @@ -51,7 +51,7 @@ def run_command_for_code(command): """ Returns command's exit code. """ - process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) process.communicate() return process.returncode diff --git a/diff_cover/violationsreporters/base.py b/diff_cover/violationsreporters/base.py index 3f1a6ca0..16ab73cf 100644 --- a/diff_cover/violationsreporters/base.py +++ b/diff_cover/violationsreporters/base.py @@ -245,3 +245,32 @@ def installed(self): Returns: boolean True if installed """ return run_command_for_code(self.command_to_check_install) == 0 + + +class JsonBasedDriver(QualityDriver): + def __init__( + self, + name, + supported_extensions, + command, + expression, + command_to_check_install, + flags=0, + exit_codes=None, + ): + """ + args: + expression: regex used to parse report, will be fed lines singly + unless flags contain re.MULTILINE + flags: such as re.MULTILINE + See super for other args + command_to_check_install: (list[str]) command to run + to see if the tool is installed + """ + + def installed(self): + """ + Method checks if the provided tool is installed. + Returns: boolean True if installed + """ + return run_command_for_code(self.command_to_check_install) == 0 \ No newline at end of file