1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-20 09:39:01 +00:00

implement branch coverage tool for function 1

This commit is contained in:
luca-denobili 2024-06-27 15:10:58 +02:00
parent 29b17b5517
commit e6485c1472

View File

@ -8,6 +8,13 @@ from .exceptions import EmptyCommand
from .utils import get_alias, format_raw_script from .utils import get_alias, format_raw_script
from .output_readers import get_output from .output_readers import get_output
branch_coverage = {
"branch_1" : False,
"branch_2" : False,
"branch_3" : False,
"branch_4" : False
}
class Command(object): class Command(object):
"""Command that should be fixed.""" """Command that should be fixed."""
@ -35,13 +42,18 @@ class Command(object):
@property @property
def script_parts(self): def script_parts(self):
if not hasattr(self, '_script_parts'): if not hasattr(self, '_script_parts'):
branch_coverage['branch_1'] = True
try: try:
branch_coverage['branch_2'] = True
self._script_parts = shell.split_command(self.script) self._script_parts = shell.split_command(self.script)
except Exception: except Exception:
branch_coverage['branch_3'] = True
logs.debug(u"Can't split command script {} because:\n {}".format( logs.debug(u"Can't split command script {} because:\n {}".format(
self, sys.exc_info())) self, sys.exc_info()))
self._script_parts = [] self._script_parts = []
else:
branch_coverage['branch_4'] = True
return self._script_parts return self._script_parts
def __eq__(self, other): def __eq__(self, other):