diff --git a/pegleg/cli.py b/pegleg/cli.py index a7c3b43c..84b03e4f 100644 --- a/pegleg/cli.py +++ b/pegleg/cli.py @@ -46,9 +46,8 @@ MAIN_REPOSITORY_OPTION = click.option( '--site-repository', 'site_repository', required=True, - help= - 'Path or URL to the primary repository (containing site_definition.yaml) ' - 'repo.') + help=('Path or URL to the primary repository (containing ' + 'site_definition.yaml) repo.')) EXTRA_REPOSITORY_OPTION = click.option( '-e', @@ -72,10 +71,10 @@ REPOSITORY_USERNAME_OPTION = click.option( '-u', '--repo-username', 'repo_username', - help= - 'The SSH username to use when cloning remote authenticated repositories ' - 'specified in the site-definition file. Any occurrences of REPO_USERNAME ' - 'will be replaced with this value.') + help=('The SSH username to use when cloning remote authenticated ' + 'repositories specified in the site-definition file. Any ' + 'occurrences of REPO_USERNAME will be replaced with this ' + 'value.')) REPOSITORY_CLONE_PATH_OPTION = click.option( '-p', @@ -96,8 +95,8 @@ ALLOW_MISSING_SUBSTITUTIONS_OPTION = click.option( required=False, type=click.BOOL, default=True, - help= - "Raise Deckhand exception on missing substition sources. Defaults to True." + help=("Raise Deckhand exception on missing substition sources. " + "Defaults to True.") ) EXCLUDE_LINT_OPTION = click.option( diff --git a/pegleg/engine/secrets.py b/pegleg/engine/secrets.py index 4812ea1b..08688bcc 100644 --- a/pegleg/engine/secrets.py +++ b/pegleg/engine/secrets.py @@ -78,8 +78,8 @@ def decrypt(file_path, site_name): """ LOG.info('Started decrypting...') - if os.path.isfile(file_path) \ - and [s for s in file_path.split(os.path.sep) if s == site_name]: + if (os.path.isfile(file_path) and + [s for s in file_path.split(os.path.sep) if s == site_name]): PeglegSecretManagement(file_path).decrypt_secrets() else: LOG.info('File: {} was not found. Check your file path and name, ' @@ -101,9 +101,8 @@ def _get_dest_path(repo_base, file_path, save_location): :rtype: string """ - if save_location \ - and save_location != os.path.sep \ - and save_location.endswith(os.path.sep): + if (save_location and save_location != os.path.sep and + save_location.endswith(os.path.sep)): save_location = save_location.rstrip(os.path.sep) if repo_base and repo_base.endswith(os.path.sep): repo_base = repo_base.rstrip(os.path.sep) diff --git a/pegleg/engine/util/git.py b/pegleg/engine/util/git.py index b1ab65fe..616e0a69 100644 --- a/pegleg/engine/util/git.py +++ b/pegleg/engine/util/git.py @@ -198,8 +198,8 @@ def _try_git_clone(repo_url, except git_exc.GitCommandError as e: LOG.exception('Failed to clone repo_url=%s using ref=%s.', repo_url, ref) - if (ssh_cmd and ssh_cmd in e.stderr - or 'permission denied' in e.stderr.lower()): + if (ssh_cmd and ssh_cmd in e.stderr or + 'permission denied' in e.stderr.lower()): raise exceptions.GitAuthException( repo_url=repo_url, ssh_key_path=auth_key) elif 'could not resolve proxy' in e.stderr.lower(): diff --git a/pegleg/engine/util/pegleg_secret_management.py b/pegleg/engine/util/pegleg_secret_management.py index 993e2d31..a939f2d9 100644 --- a/pegleg/engine/util/pegleg_secret_management.py +++ b/pegleg/engine/util/pegleg_secret_management.py @@ -42,8 +42,7 @@ class PeglegSecretManagement(): provided. """ - if all([file_path, docs]) or \ - not any([file_path, docs]): + if all([file_path, docs]) or not any([file_path, docs]): raise ValueError('Either `file_path` or `docs` must be specified.') self.__check_environment() diff --git a/tox.ini b/tox.ini index 5f1f07b2..070a0d97 100644 --- a/tox.ini +++ b/tox.ini @@ -63,4 +63,8 @@ commands = commands = {posargs} [flake8] -ignore = E125,E251,W503 +filename = *.py +show-source = true +ignore = +exclude=.venv,.git,.tox,build,dist,*lib/python*,*egg,tools,*.ini,*.po,*.pot +max-complexity = 24