Flake8 fix

This removes all PEP8 ignores and places in default settings for flake8.

Change-Id: I3c4df02dea959dfe58f44e7c0e0ac58078a81abc
Signed-off-by: Tin Lam <tin@irrational.io>
This commit is contained in:
Tin Lam 2018-11-12 01:07:52 -06:00
parent b7556bd89e
commit a3da86e311
5 changed files with 20 additions and 19 deletions

View File

@ -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(

View File

@ -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)

View File

@ -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():

View File

@ -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()

View File

@ -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