From da8b20b5fd04d902b1e51a137b787412fdf20538 Mon Sep 17 00:00:00 2001 From: miska924 Date: Tue, 20 Sep 2022 16:45:59 +0300 Subject: [PATCH] reduce cyclomatic complexity --- thefuck/rules/git_clone_missing.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/thefuck/rules/git_clone_missing.py b/thefuck/rules/git_clone_missing.py index bc5c0986..760c9f3e 100644 --- a/thefuck/rules/git_clone_missing.py +++ b/thefuck/rules/git_clone_missing.py @@ -14,17 +14,23 @@ from six.moves.urllib import parse from thefuck.utils import which -def match(command): - # We want it to be a URL by itself - if len(command.script_parts) != 1: - return False - # Ensure we got the error we expected +def is_expected_error(command): if which(command.script_parts[0]) or not ( 'No such file or directory' in command.output or 'not found' in command.output or 'is not recognised as' in command.output ): return False + return True + + +def match(command): + # We want it to be a URL by itself + if len(command.script_parts) != 1: + return False + # Ensure we got the error we expected + if not is_expected_error(command): + return False url = parse.urlparse(command.script, scheme='ssh') # HTTP URLs need a network address if not url.netloc and url.scheme != 'ssh':