Skip to content

Commit 2711745

Browse files
committed
Fix codacy issues
* add codacy config file * fix security relevant issues
1 parent 6138737 commit 2711745

File tree

5 files changed

+18
-10
lines changed

5 files changed

+18
-10
lines changed

.codacy.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
exclude_paths:
3+
- '.github/**'
4+
- '.vscode/**'
5+
- 'CHANGELOG.md'
6+
- 'CONTRIBUTING.md'
7+
- 'docs/**'
8+
- 'README.md'

click_types/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"""Python package that provides custom click types"""
1+
"""Python package that provides custom click types."""

click_types/ansible.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Module for custom click types regarding to ansible"""
1+
"""Module for custom click types regarding to ansible."""
22

33
import click
44
import os
@@ -64,7 +64,7 @@ def convert(self, value, param, ctx):
6464
data = self.v.load(open(self.vault).read())
6565
except AnsibleError as e:
6666
if 'not vault encrypted data' in str(e):
67-
data = yaml.load(open(self.vault).read(), SafeLoader) or {}
67+
data = yaml.safe_load(open(self.vault).read(), SafeLoader) or {}
6868
except Exception as e:
6969
self.fail('Decryption failed: {0}'.format(str(e)), param, ctx)
7070

@@ -74,26 +74,26 @@ def convert(self, value, param, ctx):
7474

7575
try:
7676
self.v.dump(data, open(self.vault, 'w'))
77-
except: # noqa: E722
77+
except Exception:
7878
self.fail('Error while encrypting data', param, ctx)
7979

8080
return self.path
8181

82-
def _populate_data(self, input={}, keys=[], value=None):
82+
def _populate_data(self, origin: dict = None, keys: list = None, value: str = None):
8383
"""Save value at the desired position in vault.
8484
8585
This method takes vault data, a list of keys where to store the value.
8686
87-
:param input: The dictionary of vault data, defaults to {}
88-
:type input: dict, optional
87+
:param origin: The dictionary of vault data, defaults to {}
88+
:type origin: dict, optional
8989
:param keys: List of keys that describe the desired position in vault, defaults to []
9090
:type keys: list, optional
9191
:param value: The value to store in vault, defaults to None
9292
:type value: str, optional
9393
:return: The vault data extended by `value` at the desired position.
9494
:rtype: dict
9595
"""
96-
data = input.copy()
96+
data = origin.copy()
9797

9898
if keys:
9999
key = keys[0]

click_types/coding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Module for custom click types regarding to development"""
1+
"""Module for custom click types regarding to development."""
22

33
import semver
44

click_types/net.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Module for custom click types regarding to network"""
1+
"""Module for custom click types regarding to network."""
22

33
import click
44
import ipaddress

0 commit comments

Comments
 (0)