diff --git a/plugins/module_utils/ansible_freeipa_module.py b/plugins/module_utils/ansible_freeipa_module.py index 9a040ad0fe321b427f2eee21351b91995fc9c6da..a725af018dd4ea6a56d3047a2bad3ffa3731c97c 100644 --- a/plugins/module_utils/ansible_freeipa_module.py +++ b/plugins/module_utils/ansible_freeipa_module.py @@ -57,7 +57,7 @@ else: # FreeIPA releases. import re - class version: + class version: # pylint: disable=invalid-name @staticmethod def parse(version_str): """ @@ -460,7 +460,7 @@ else: cert = load_certificate(cert.encode('utf-8')) return cert - def DN_x500_text(text): + def DN_x500_text(text): # pylint: disable=invalid-name if hasattr(DN, "x500_text"): return DN(text).x500_text() else: diff --git a/plugins/modules/ipaconfig.py b/plugins/modules/ipaconfig.py index e97e364785dd0a4c61fa0a7e23253dc02ea4c109..5e4a1bae01be765db9c4d0f679a500cd1b6984c9 100644 --- a/plugins/modules/ipaconfig.py +++ b/plugins/modules/ipaconfig.py @@ -264,10 +264,7 @@ def config_show(module): def gen_args(params): - _args = {} - for k, v in params.items(): - if v is not None: - _args[k] = v + _args = {k: v for k, v in params.items() if v is not None} return _args @@ -434,7 +431,7 @@ def main(): rawresult = api_command_no_name(ansible_module, "config_show", {}) result = rawresult['result'] del result['dn'] - for key, v in result.items(): + for key, value in result.items(): k = reverse_field_map.get(key, key) if ansible_module.argument_spec.get(k): if k == 'ipaselinuxusermaporder': @@ -449,20 +446,20 @@ def main(): elif k == 'groupsearch': exit_args['groupsearch'] = \ result.get(key)[0].split(',') - elif isinstance(v, str) and \ + elif isinstance(value, str) and \ ansible_module.argument_spec[k]['type'] == "list": - exit_args[k] = [v] - elif isinstance(v, list) and \ + exit_args[k] = [value] + elif isinstance(value, list) and \ ansible_module.argument_spec[k]['type'] == "str": - exit_args[k] = ",".join(v) - elif isinstance(v, list) and \ + exit_args[k] = ",".join(value) + elif isinstance(value, list) and \ ansible_module.argument_spec[k]['type'] == "int": - exit_args[k] = ",".join(v) - elif isinstance(v, list) and \ + exit_args[k] = ",".join(value) + elif isinstance(value, list) and \ ansible_module.argument_spec[k]['type'] == "bool": - exit_args[k] = (v[0] == "TRUE") + exit_args[k] = (value[0] == "TRUE") else: - exit_args[k] = v + exit_args[k] = value except ipalib_errors.EmptyModlist: changed = False except Exception as e: diff --git a/plugins/modules/ipadnsrecord.py b/plugins/modules/ipadnsrecord.py index 0b998be6f13b4b7e5d531f621def9d7ea25c6963..1741a7a74a2051d0aa439a87521ed48d3fecee88 100644 --- a/plugins/modules/ipadnsrecord.py +++ b/plugins/modules/ipadnsrecord.py @@ -1377,7 +1377,7 @@ def define_commands_for_present_state(module, zone_name, entry, res_find): _args['idnsname'] = name _commands.append([zone_name, 'dnsrecord_add', _args]) # clean used fields from args - for f in part_fields: + for f in part_fields: # pylint: disable=invalid-name if f in args: del args[f] else: diff --git a/plugins/modules/ipauser.py b/plugins/modules/ipauser.py index 2e80811a8b65294a327a6241fed47363ab8aaf33..576fc59bc3377584bfdab2212ac58f10e2366778 100644 --- a/plugins/modules/ipauser.py +++ b/plugins/modules/ipauser.py @@ -712,7 +712,7 @@ def check_certmapdata(data): return False i = data.find("<I>", 4) - s = data.find("<S>", i) + s = data.find("<S>", i) # pylint: disable=invalid-name issuer = data[i+3:s] subject = data[s+3:] diff --git a/setup.cfg b/setup.cfg index 4d60e31fa33eda466101920e0db8757e259eeb95..d06c1495fcd1b4ffdf17fe01dada92e0a9e81179 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,3 +31,18 @@ per-file-ignores = [pydocstyle] inherit = false ignore = D1,D212,D203 +[pylint.BASIC] +good-names = ex, i, j, k, Run, _, e, x, dn, cn, ip, os, unicode + +[pylint.IMPORTS] +ignored-modules = + ansible.module_utils.ansible_freeipa_module, + ipalib, ipalib.config, ipalib.constants, ipalib.krb_utils, ipalib.errors, + ipapython.ipautil, ipapython.dn, ipapython.version, ipapython.dnsutil, + ipaplatform.paths + +[pylint.REFACTORING] +max-nested-blocks = 9 + +[pylint.FORMAT] +max-line-length = 80