refactor: additional code quality improvements (#78)

This commit is contained in:
Ankit Dobhal 2021-02-12 21:18:45 +05:30 committed by GitHub
parent 3ae0e358c0
commit 72d85b002b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -200,7 +200,7 @@ class Candidate(object):
or filename.endswith(".py")
):
return Code(filename, settings, standards)
if "inventory" == basename or "hosts" == basename or parentdir in ["inventories"]:
if basename == "inventory" or basename == "hosts" or parentdir in ["inventories"]:
return Inventory(filename, settings, standards)
if "rolesfile" in basename or "requirements" in basename:
return Rolesfile(filename, settings, standards)

View File

@ -28,7 +28,7 @@ class CheckShellInsteadCommand(StandardBase):
cmd = " ".join(task["action"].get("__ansible_arguments__", []))
unjinja = re.sub(r"\{\{[^\}]*\}\}", "JINJA_VAR", cmd)
if not any([ch in unjinja for ch in "&|<>;$\n*[]{}?"]):
if not any(ch in unjinja for ch in "&|<>;$\n*[]{}?"):
errors.append(self.Error(task["__line__"], self.helptext))
return self.Result(candidate.path, errors)

View File

@ -63,7 +63,7 @@ def lines_ranges(lines_spec):
def is_line_in_ranges(line, ranges):
return not ranges or any([line in r for r in ranges])
return not ranges or any(line in r for r in ranges)
def safe_load(string):