From b7b74bfb9c54aa023a0ecd5f9cb3a2b4139b001d Mon Sep 17 00:00:00 2001 From: Azat Ibrakov Date: Thu, 14 Nov 2024 00:27:56 +0100 Subject: [PATCH] Complete "ruff" configurations --- pyproject.toml | 13 +++++++++++++ tests/integer_tests/int_tests/test__eq__.py | 4 ++-- tests/meta_utils.py | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 012b3c1..85e8f5c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,6 +58,8 @@ select = [ "A", # flake8-annotations "ANN", + # flake8-unused-arguments + "ARG", # flake8-bugbear "B", # flake8-blind-except @@ -72,12 +74,16 @@ select = [ "FA", # flake8-boolean-trap "FBT", + # refurb + "FURB", # isort "I", # flake8-implicit-str-concat "ISC", # pep8-naming "N", + # Perflint + "PERF", # flake8-pie "PIE", # flake8-pytest-style @@ -88,6 +94,8 @@ select = [ "RET", # flake8-raise "RSE", + # Ruff-specific rules + "RUF", # flake8-simplify "SIM", # flake8-self @@ -96,6 +104,8 @@ select = [ "T10", # flake8-print "T20", + # flake8-tidy-imports + "TID", # pyupgrade "UP", # pycodestyle @@ -119,5 +129,8 @@ order-by-type = false relative-imports-order = "closest-to-furthest" split-on-trailing-comma = false +[tool.ruff.lint.per-file-ignores] +"tests/*" = ["RUF018"] + [tool.setuptools.dynamic] version = { attr = "rithm.__version__" } diff --git a/tests/integer_tests/int_tests/test__eq__.py b/tests/integer_tests/int_tests/test__eq__.py index 39fa5b5..5a9f61d 100644 --- a/tests/integer_tests/int_tests/test__eq__.py +++ b/tests/integer_tests/int_tests/test__eq__.py @@ -25,9 +25,9 @@ def test_transitivity(first: Int, second: Int, third: Int) -> None: def test_alternatives(first: Int, second: Int) -> None: assert equivalence(first == second, first == second) assert equivalence(first == second, first >= second and first <= second) - assert equivalence(first == second, first >= second and second >= first) + assert equivalence(first == second, first >= second >= first) assert equivalence(first == second, second <= first and second >= first) - assert equivalence(first == second, second <= first and first <= second) + assert equivalence(first == second, second <= first <= second) @given(strategies.ints, strategies.ints_with_builtins) diff --git a/tests/meta_utils.py b/tests/meta_utils.py index df0ffa9..0f55e89 100644 --- a/tests/meta_utils.py +++ b/tests/meta_utils.py @@ -146,7 +146,7 @@ def to_sorted_lists_diff( try: while (right_element := next(right_elements)) < left_element: result.append((None, right_element)) - except StopIteration: + except StopIteration: # noqa: PERF203 result.append((left_element, None)) result.extend( (left_element, None) for left_element in left_elements