Browse Source

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>
Tin Lam 5 months ago
parent
commit
a3da86e311
5 changed files with 20 additions and 19 deletions
  1. 8
    9
      pegleg/cli.py
  2. 4
    5
      pegleg/engine/secrets.py
  3. 2
    2
      pegleg/engine/util/git.py
  4. 1
    2
      pegleg/engine/util/pegleg_secret_management.py
  5. 5
    1
      tox.ini

+ 8
- 9
pegleg/cli.py View File

@@ -46,9 +46,8 @@ MAIN_REPOSITORY_OPTION = click.option(
46 46
     '--site-repository',
47 47
     'site_repository',
48 48
     required=True,
49
-    help=
50
-    'Path or URL to the primary repository (containing site_definition.yaml) '
51
-    'repo.')
49
+    help=('Path or URL to the primary repository (containing '
50
+          'site_definition.yaml) repo.'))
52 51
 
53 52
 EXTRA_REPOSITORY_OPTION = click.option(
54 53
     '-e',
@@ -72,10 +71,10 @@ REPOSITORY_USERNAME_OPTION = click.option(
72 71
     '-u',
73 72
     '--repo-username',
74 73
     'repo_username',
75
-    help=
76
-    'The SSH username to use when cloning remote authenticated repositories '
77
-    'specified in the site-definition file. Any occurrences of REPO_USERNAME '
78
-    'will be replaced with this value.')
74
+    help=('The SSH username to use when cloning remote authenticated '
75
+          'repositories specified in the site-definition file. Any '
76
+          'occurrences of REPO_USERNAME will be replaced with this '
77
+          'value.'))
79 78
 
80 79
 REPOSITORY_CLONE_PATH_OPTION = click.option(
81 80
     '-p',
@@ -96,8 +95,8 @@ ALLOW_MISSING_SUBSTITUTIONS_OPTION = click.option(
96 95
     required=False,
97 96
     type=click.BOOL,
98 97
     default=True,
99
-    help=
100
-    "Raise Deckhand exception on missing substition sources. Defaults to True."
98
+    help=("Raise Deckhand exception on missing substition sources. "
99
+          "Defaults to True.")
101 100
 )
102 101
 
103 102
 EXCLUDE_LINT_OPTION = click.option(

+ 4
- 5
pegleg/engine/secrets.py View File

@@ -78,8 +78,8 @@ def decrypt(file_path, site_name):
78 78
     """
79 79
 
80 80
     LOG.info('Started decrypting...')
81
-    if os.path.isfile(file_path) \
82
-        and [s for s in file_path.split(os.path.sep) if s == site_name]:
81
+    if (os.path.isfile(file_path) and
82
+            [s for s in file_path.split(os.path.sep) if s == site_name]):
83 83
         PeglegSecretManagement(file_path).decrypt_secrets()
84 84
     else:
85 85
         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):
101 101
     :rtype: string
102 102
     """
103 103
 
104
-    if save_location \
105
-        and save_location != os.path.sep \
106
-        and save_location.endswith(os.path.sep):
104
+    if (save_location and save_location != os.path.sep and
105
+            save_location.endswith(os.path.sep)):
107 106
         save_location = save_location.rstrip(os.path.sep)
108 107
     if repo_base and repo_base.endswith(os.path.sep):
109 108
         repo_base = repo_base.rstrip(os.path.sep)

+ 2
- 2
pegleg/engine/util/git.py View File

@@ -198,8 +198,8 @@ def _try_git_clone(repo_url,
198 198
     except git_exc.GitCommandError as e:
199 199
         LOG.exception('Failed to clone repo_url=%s using ref=%s.', repo_url,
200 200
                       ref)
201
-        if (ssh_cmd and ssh_cmd in e.stderr
202
-                or 'permission denied' in e.stderr.lower()):
201
+        if (ssh_cmd and ssh_cmd in e.stderr or
202
+                'permission denied' in e.stderr.lower()):
203 203
             raise exceptions.GitAuthException(
204 204
                 repo_url=repo_url, ssh_key_path=auth_key)
205 205
         elif 'could not resolve proxy' in e.stderr.lower():

+ 1
- 2
pegleg/engine/util/pegleg_secret_management.py View File

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

+ 5
- 1
tox.ini View File

@@ -63,4 +63,8 @@ commands =
63 63
 commands = {posargs}
64 64
 
65 65
 [flake8]
66
-ignore = E125,E251,W503
66
+filename = *.py
67
+show-source = true
68
+ignore =
69
+exclude=.venv,.git,.tox,build,dist,*lib/python*,*egg,tools,*.ini,*.po,*.pot
70
+max-complexity = 24

Loading…
Cancel
Save