diff --git a/.deepsource.toml b/.deepsource.toml new file mode 100644 index 000000000..2bc248cdf --- /dev/null +++ b/.deepsource.toml @@ -0,0 +1,18 @@ +version = 1 + +test_patterns = ["tests/**"] + +exclude_patterns = [ + "roles/**", + "profiles/**", + "infrastructure-playbooks/**", + "group_vars/**", + "contrib/**" +] + +[[analyzers]] +name = "python" +enabled = true + + [analyzers.meta] + runtime_version = "3.x.x" \ No newline at end of file diff --git a/plugins/actions/config_template.py b/plugins/actions/config_template.py index fbf65081c..b7890d232 100644 --- a/plugins/actions/config_template.py +++ b/plugins/actions/config_template.py @@ -179,8 +179,8 @@ class ConfigTemplateParser(ConfigParser.RawConfigParser): _write_comments(section_name, optname=key) self._write_check(fp, key=key, value=value, section=section_bool) - else: - fp.write("\n") + + fp.write("\n") def _write_comments(section, optname=None): comsect = self._comments.get(section, {}) @@ -453,8 +453,8 @@ class ActionModule(ActionBase): 'data. Sections are case sensitive.' ) raise errors.AnsibleModuleError(error_msg) - else: - config_object.close() + + config_object.close() config_dict_new = {} config_defaults = config.defaults() @@ -665,7 +665,7 @@ class ActionModule(ActionBase): return True, dict( source=source, dest=user_dest, - config_overrides=self._task.args.get('config_overrides', dict()), + config_overrides=self._task.args.get('config_overrides', {}), config_type=config_type, searchpath=searchpath, list_extend=list_extend, diff --git a/plugins/filter/ipaddrs_in_ranges.py b/plugins/filter/ipaddrs_in_ranges.py index fdd4d7fd3..eabdbc309 100644 --- a/plugins/filter/ipaddrs_in_ranges.py +++ b/plugins/filter/ipaddrs_in_ranges.py @@ -14,7 +14,7 @@ class FilterModule(object): ''' IP addresses within IP ranges ''' def ips_in_ranges(self, ip_addresses, ip_ranges): - ips_in_ranges = list() + ips_in_ranges = [] for ip_addr in ip_addresses: for ip_range in ip_ranges: if netaddr.IPAddress(ip_addr) in netaddr.IPNetwork(ip_range): diff --git a/tests/functional/tests/nfs/test_nfs_ganesha.py b/tests/functional/tests/nfs/test_nfs_ganesha.py index b3c92ebaf..2b8c0c035 100644 --- a/tests/functional/tests/nfs/test_nfs_ganesha.py +++ b/tests/functional/tests/nfs/test_nfs_ganesha.py @@ -38,8 +38,8 @@ class TestNFSs(object): cluster=cluster ) output = host.check_output(cmd) - keys = [i for i in json.loads( - output)["servicemap"]["services"]["rgw-nfs"]["daemons"].keys()] + keys = list(json.loads( + output)["servicemap"]["services"]["rgw-nfs"]["daemons"].keys()) keys.remove('summary') daemons = json.loads(output)["servicemap"]["services"]["rgw-nfs"]["daemons"] hostnames = [] diff --git a/tests/functional/tests/rgw/test_rgw.py b/tests/functional/tests/rgw/test_rgw.py index ab30cda8f..07cadd705 100644 --- a/tests/functional/tests/rgw/test_rgw.py +++ b/tests/functional/tests/rgw/test_rgw.py @@ -36,8 +36,8 @@ class TestRGWs(object): cluster=cluster ) output = host.check_output(cmd) - keys = [i for i in json.loads( - output)["servicemap"]["services"]["rgw"]["daemons"].keys()] + keys = list(json.loads( + output)["servicemap"]["services"]["rgw"]["daemons"].keys()) keys.remove('summary') daemons = json.loads(output)["servicemap"]["services"]["rgw"]["daemons"] hostnames = []