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',
'site_repository', 'site_repository',
required=True, required=True,
help= help=('Path or URL to the primary repository (containing '
'Path or URL to the primary repository (containing site_definition.yaml) ' 'site_definition.yaml) repo.'))
'repo.')
EXTRA_REPOSITORY_OPTION = click.option( EXTRA_REPOSITORY_OPTION = click.option(
'-e', '-e',
@ -72,10 +71,10 @@ REPOSITORY_USERNAME_OPTION = click.option(
'-u', '-u',
'--repo-username', '--repo-username',
'repo_username', 'repo_username',
help= help=('The SSH username to use when cloning remote authenticated '
'The SSH username to use when cloning remote authenticated repositories ' 'repositories specified in the site-definition file. Any '
'specified in the site-definition file. Any occurrences of REPO_USERNAME ' 'occurrences of REPO_USERNAME will be replaced with this '
'will be replaced with this value.') 'value.'))
REPOSITORY_CLONE_PATH_OPTION = click.option( REPOSITORY_CLONE_PATH_OPTION = click.option(
'-p', '-p',
@ -96,8 +95,8 @@ ALLOW_MISSING_SUBSTITUTIONS_OPTION = click.option(
required=False, required=False,
type=click.BOOL, type=click.BOOL,
default=True, default=True,
help= help=("Raise Deckhand exception on missing substition sources. "
"Raise Deckhand exception on missing substition sources. Defaults to True." "Defaults to True.")
) )
EXCLUDE_LINT_OPTION = click.option( EXCLUDE_LINT_OPTION = click.option(

View File

@ -78,8 +78,8 @@ def decrypt(file_path, site_name):
""" """
LOG.info('Started decrypting...') LOG.info('Started decrypting...')
if os.path.isfile(file_path) \ if (os.path.isfile(file_path) and
and [s for s in file_path.split(os.path.sep) if s == site_name]: [s for s in file_path.split(os.path.sep) if s == site_name]):
PeglegSecretManagement(file_path).decrypt_secrets() PeglegSecretManagement(file_path).decrypt_secrets()
else: else:
LOG.info('File: {} was not found. Check your file path and name, ' 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 :rtype: string
""" """
if save_location \ if (save_location and save_location != os.path.sep and
and save_location != os.path.sep \ save_location.endswith(os.path.sep)):
and save_location.endswith(os.path.sep):
save_location = save_location.rstrip(os.path.sep) save_location = save_location.rstrip(os.path.sep)
if repo_base and repo_base.endswith(os.path.sep): if repo_base and repo_base.endswith(os.path.sep):
repo_base = repo_base.rstrip(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: except git_exc.GitCommandError as e:
LOG.exception('Failed to clone repo_url=%s using ref=%s.', repo_url, LOG.exception('Failed to clone repo_url=%s using ref=%s.', repo_url,
ref) ref)
if (ssh_cmd and ssh_cmd in e.stderr if (ssh_cmd and ssh_cmd in e.stderr or
or 'permission denied' in e.stderr.lower()): 'permission denied' in e.stderr.lower()):
raise exceptions.GitAuthException( raise exceptions.GitAuthException(
repo_url=repo_url, ssh_key_path=auth_key) repo_url=repo_url, ssh_key_path=auth_key)
elif 'could not resolve proxy' in e.stderr.lower(): elif 'could not resolve proxy' in e.stderr.lower():

View File

@ -42,8 +42,7 @@ class PeglegSecretManagement():
provided. provided.
""" """
if all([file_path, docs]) or \ if all([file_path, docs]) or not any([file_path, docs]):
not any([file_path, docs]):
raise ValueError('Either `file_path` or `docs` must be specified.') raise ValueError('Either `file_path` or `docs` must be specified.')
self.__check_environment() self.__check_environment()

View File

@ -63,4 +63,8 @@ commands =
commands = {posargs} commands = {posargs}
[flake8] [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