From 23b85ad4f949246ccc06157ef218d25bd6842fc7 Mon Sep 17 00:00:00 2001 From: Lukas Berbuer Date: Thu, 23 Mar 2023 21:31:41 +0100 Subject: [PATCH] Fix ruff errors --- .pre-commit-config.yaml | 2 +- src/conan_check_updates/cli.py | 2 +- src/conan_check_updates/conan.py | 4 ++-- tests/test_cli.py | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 34b3cb5..3f43ee6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ repos: hooks: - id: black - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.247 + rev: v0.0.258 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] diff --git a/src/conan_check_updates/cli.py b/src/conan_check_updates/cli.py index c279eba..c079443 100644 --- a/src/conan_check_updates/cli.py +++ b/src/conan_check_updates/cli.py @@ -171,7 +171,7 @@ def highlighted_version_difference(version: VersionLike, compare: VersionLike) - version = str(version) compare = str(compare) i_first_diff = next( - (i for i, (s1, s2) in enumerate(zip(version, compare)) if s1 != s2), # noqa: B905 + (i for i, (s1, s2) in enumerate(zip(version, compare)) if s1 != s2), None, ) if i_first_diff is None: diff --git a/src/conan_check_updates/conan.py b/src/conan_check_updates/conan.py index b6ccb32..4a60c14 100644 --- a/src/conan_check_updates/conan.py +++ b/src/conan_check_updates/conan.py @@ -215,8 +215,8 @@ def inspect_requires_conanfile_txt(conanfile: Path) -> List[ConanReference]: attributes = defaultdict(list) with open(conanfile, mode="r", encoding="utf-8") as file: key = None - for line in file: - line = line.strip() + for line_orig in file: + line = line_orig.strip() # strip end of line comment line = line.partition(" #")[0].strip() # ignore empty line or line comments diff --git a/tests/test_cli.py b/tests/test_cli.py index 4a7cf53..1dae0bb 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -36,8 +36,8 @@ def test_parse_args_version(capsys): assert e.value.code == 0 stdout, stderr = capsys.readouterr() - assert stdout != "" - assert stderr == "" + assert stdout + assert not stderr version_parts = stdout.split(".") assert len(version_parts) == 3