diff --git a/pyproject.toml b/pyproject.toml index e82282ec4..01e5b0c29 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -308,7 +308,6 @@ ignore = [ 'PGH003', # Use specific rule codes when ignoring type issues 'PIE810', # [*] Call `startswith` once with a `tuple` 'PD011', # https://github.com/astral-sh/ruff/issues/2229 - 'PLC1901', # `self.fs_source == ""` can be simplified to `not self.fs_source` as an empty string is falsey 'PLR0911', # Too many return statements (8 > 6) 'PLR0912', # Too many branches (13 > 12) 'PLR0913', # Too many arguments to function call (7 > 5) @@ -343,13 +342,10 @@ ignore = [ 'RET504', # Unnecessary variable assignment before `return` statement 'RET505', # Unnecessary `else` after `return` statement 'RUF005', # [*] Consider `[self._name, *shlex.split(self._interaction.action.match.groupdict()["params"] or "")]` instead of concatenation - 'RUF009', # Do not perform function call `PresentableCliParameters` in dataclass defaults 'RUF012', # Mutable class attributes should be annotated with `typing.ClassVar` - 'RUF100', # [*] Unused `noqa` directive (unused: `E731`) 'S101', # Use of `assert` detected 'S103', # `os.chmod` setting a permissive mask `0o777` on file or directory 'S108', # Probable insecure usage of temporary file or directory: "/tmp" - 'S110', # `try`-`except`-`pass` detected, consider logging the exception 'S311', # Standard pseudo-random generators are not suitable for cryptographic purposes 'S602', # `subprocess` call with `shell=True` identified, security issue 'S603', # `subprocess` call: check for execution of untrusted input diff --git a/src/ansible_navigator/actions/run.py b/src/ansible_navigator/actions/run.py index 67cc0be3e..35f8a48df 100644 --- a/src/ansible_navigator/actions/run.py +++ b/src/ansible_navigator/actions/run.py @@ -66,7 +66,7 @@ def get_color(word: str) -> int: :param word: Keyword to match color. :returns: Color value """ - return next( # noqa: E731 + return next( (x[1] for x in RESULT_TO_COLOR if re.match(x[0], word)), 0, ) diff --git a/src/ansible_navigator/configuration_subsystem/defs_presentable.py b/src/ansible_navigator/configuration_subsystem/defs_presentable.py index de6c401e5..62a199044 100644 --- a/src/ansible_navigator/configuration_subsystem/defs_presentable.py +++ b/src/ansible_navigator/configuration_subsystem/defs_presentable.py @@ -3,6 +3,7 @@ from __future__ import annotations from dataclasses import dataclass +from dataclasses import field from typing import Any from typing import ClassVar from typing import NewType @@ -82,7 +83,7 @@ class PresentableSettingsEntry(ContentBase[Any]): """A list of subcommands where this entry is available""" version_added: str """The version this entry was added in""" - cli_parameters: PresentableCliParameters = PresentableCliParameters() + cli_parameters: PresentableCliParameters = field(default_factory=PresentableCliParameters) """The CLI parameters, long and short""" @property diff --git a/src/ansible_navigator/configuration_subsystem/navigator_configuration.py b/src/ansible_navigator/configuration_subsystem/navigator_configuration.py index d66262e82..9572a3b01 100644 --- a/src/ansible_navigator/configuration_subsystem/navigator_configuration.py +++ b/src/ansible_navigator/configuration_subsystem/navigator_configuration.py @@ -91,7 +91,7 @@ class Internals: ansible_configuration: AnsibleConfiguration = field(default_factory=AnsibleConfiguration) action_packages: tuple[str] = ("ansible_navigator.actions",) - cache_path: Path = generate_cache_path(APP_NAME.replace("_", "-")) + cache_path: Path = generate_cache_path(APP_NAME.replace("_", "-")) # noqa: RUF009 collection_doc_cache: C | KeyValueStore = C.NOT_SET initializing: bool = False """This is an initial run (app starting for the first time).""" diff --git a/src/ansible_navigator/tm_tokenize/reg.py b/src/ansible_navigator/tm_tokenize/reg.py index 14ef9d398..224c4b85a 100644 --- a/src/ansible_navigator/tm_tokenize/reg.py +++ b/src/ansible_navigator/tm_tokenize/reg.py @@ -24,7 +24,7 @@ _FLAGS = { - # (first_line, boundary) # noqa: E800 + # (first_line, boundary) (False, False): ( onigurumacffi.OnigSearchOption.NOT_END_STRING | onigurumacffi.OnigSearchOption.NOT_BEGIN_STRING diff --git a/src/ansible_navigator/ui_framework/form_handler_options.py b/src/ansible_navigator/ui_framework/form_handler_options.py index 9216b5408..577c5bca7 100644 --- a/src/ansible_navigator/ui_framework/form_handler_options.py +++ b/src/ansible_navigator/ui_framework/form_handler_options.py @@ -45,7 +45,7 @@ def populate(self, form_field: FieldText, active: int) -> None: if self._ui_config.color is False: text = ( f"[{option.text.capitalize()}]" if idx == active else option.text + " " - ) # clear the [], for else # noqa: E501 + ) # clear the [], for else else: text = option.text clp_text = CursesLinePart(len(option_code) + 1, text, color, decoration) diff --git a/src/ansible_navigator/utils/dict_merge.py b/src/ansible_navigator/utils/dict_merge.py index c91c7f8b6..ba2d717fc 100644 --- a/src/ansible_navigator/utils/dict_merge.py +++ b/src/ansible_navigator/utils/dict_merge.py @@ -27,7 +27,7 @@ def in_place_list_replace(left: Mergeable, right: Mergeable) -> Mergeable: """ key = None try: - if left is None or isinstance(left, str | int | float | bool): # noqa: SIM114 + if left is None or isinstance(left, str | int | float | bool): # Border case for first run or if a is a primitive left = right elif isinstance(left, tuple | list): diff --git a/src/ansible_navigator/utils/serialize.py b/src/ansible_navigator/utils/serialize.py index 988103e22..6620b886b 100644 --- a/src/ansible_navigator/utils/serialize.py +++ b/src/ansible_navigator/utils/serialize.py @@ -29,14 +29,14 @@ try: from yaml import CSafeDumper as SafeDumper except ImportError: - from yaml import SafeDumper # type: ignore # noqa: F401 + from yaml import SafeDumper # type: ignore try: from yaml import CLoader as Loader from yaml import CSafeLoader as SafeLoader except ImportError: - from yaml import Loader # type: ignore # noqa: F401 - from yaml import SafeLoader # type: ignore # noqa: F401 + from yaml import Loader # type: ignore + from yaml import SafeLoader # type: ignore def serialize( diff --git a/tests/unit/test_circular_imports.py b/tests/unit/test_circular_imports.py index 196536c17..76d01e882 100644 --- a/tests/unit/test_circular_imports.py +++ b/tests/unit/test_circular_imports.py @@ -9,12 +9,12 @@ * https://github.com/pytest-dev/pytest/blob/d18c75b/testing/test_meta.py * https://twitter.com/codewithanthony/status/1229445110510735361 * https://github.com/aio-libs/aiohttp/blob/master/tests/test_circular_imports.py -""" # noqa: E501 +""" from __future__ import annotations import os import pkgutil -import subprocess # noqa: S404 Required due to the nature of this test +import subprocess # Required due to the nature of this test import sys from collections.abc import Generator @@ -108,4 +108,4 @@ def test_no_warnings(import_path: str) -> None: f"import {import_path!s}", ) - subprocess.check_call(imp_cmd) # noqa: S603 Input is trusted, generated above, not external + subprocess.check_call(imp_cmd) # Input is trusted, generated above, not external