From 357606e1e9bc59d68db3920ad5fdcf9a987634dd Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Wed, 28 Jun 2023 09:17:10 +0200 Subject: [PATCH] fix linting --- ansiblelater/candidate.py | 2 +- ansiblelater/standard.py | 2 +- ansiblelater/utils/yamlhelper.py | 6 ++---- pyproject.toml | 1 + 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ansiblelater/candidate.py b/ansiblelater/candidate.py index 12194e2..007a122 100644 --- a/ansiblelater/candidate.py +++ b/ansiblelater/candidate.py @@ -191,7 +191,7 @@ class Candidate: if sid: standard_id = f"[{sid}] " - return standard_id # noqa + return standard_id def __repr__(self): return f"{type(self).__name__} ({self.path})" diff --git a/ansiblelater/standard.py b/ansiblelater/standard.py index 4a66bc7..f9760bf 100644 --- a/ansiblelater/standard.py +++ b/ansiblelater/standard.py @@ -304,7 +304,7 @@ class StandardBase(metaclass=StandardExtendedMeta): return "\n".join([f"{self.candidate}:{error}" for error in self.errors]) -class StandardLoader(): +class StandardLoader: def __init__(self, source): self.rules = [] diff --git a/ansiblelater/utils/yamlhelper.py b/ansiblelater/utils/yamlhelper.py index 05207a9..3807ac2 100644 --- a/ansiblelater/utils/yamlhelper.py +++ b/ansiblelater/utils/yamlhelper.py @@ -209,11 +209,10 @@ def template(basedir, value, variables, fail_on_undefined=False, **kwargs): # Hack to skip the following exception when using to_json filter on a variable. # I guess the filter doesn't like empty vars... with suppress(AnsibleError, ValueError): - value = ansible_template( + return ansible_template( os.path.abspath(basedir), value, variables, **dict(kwargs, fail_on_undefined=fail_on_undefined) ) - return value def play_children(basedir, item, parent_type): @@ -373,8 +372,7 @@ def rolename(filepath): if idx < 0: return "" role = filepath[idx + 6:] - role = role[:role.find("/")] - return role + return role[:role.find("/")] def _kv_to_dict(v): diff --git a/pyproject.toml b/pyproject.toml index 0bcf6c3..eb151dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -118,6 +118,7 @@ ignore = [ "D203", "D212", "UP038", + "RUF012", ] line-length = 99 select = [