diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b8d3dd79..d0106569 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,10 +1,7 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - # Ruff version. - rev: v0.14.6 + rev: v0.15.21 hooks: - # Run the formatter. - id: ruff-format - # Run the linter. - id: ruff-check - args: [ '--fix' ] + args: [--fix, --show-fixes] diff --git a/CHANGELOG.md b/CHANGELOG.md index b81359b9..a85ef9ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # 2.17 (unreleased) * Add support for Python 3.15 and drop 3.9 (Hugo van Kemenade, #416). +* Add pylint and refurb ruff rules (even-even). # 2.16 (2026-03-25) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0d47857a..d99119de 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -87,7 +87,7 @@ of "Fixed issue12.". Please make sure that you only fix the issue at hand or implement the desired new feature instead of making "drive-by" changes like adding type hints. -### Formating and linting +### Formatting and linting Run `pre-commit` using: diff --git a/pyproject.toml b/pyproject.toml index e456fee8..8e8db5e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -90,6 +90,9 @@ select = [ "UP", # pyupgrade "RUF", # ruff-specific rules "PERF", # perflint + "FURB", # refurb + "PLE", # pylint (errors) + "PLW", # pylint (warnings) ] ignore = [ "C408", # unnecessary dict call diff --git a/tests/test_conditions.py b/tests/test_conditions.py index c401b226..86d7bea1 100644 --- a/tests/test_conditions.py +++ b/tests/test_conditions.py @@ -49,8 +49,8 @@ def test_complex_conditions(): ("foo and (False or [])", True, False), ('(foo and bar) or {"a": 1}', False, True), ] - for condition, always_false, always_true in conditions: - condition = ast.parse(condition, mode="eval").body + for condition_str, always_false, always_true in conditions: + condition = ast.parse(condition_str, mode="eval").body assert not (always_false and always_true) assert utils.condition_is_always_false(condition) == always_false assert utils.condition_is_always_true(condition) == always_true @@ -68,7 +68,7 @@ def test_errors(): "locals()", "().__class__", ] - for condition in conditions: - condition = ast.parse(condition, mode="eval").body + for condition_str in conditions: + condition = ast.parse(condition_str, mode="eval").body assert not utils.condition_is_always_false(condition) assert not utils.condition_is_always_true(condition) diff --git a/vulture/noqa.py b/vulture/noqa.py index 7c9bedeb..5c2b655a 100644 --- a/vulture/noqa.py +++ b/vulture/noqa.py @@ -33,8 +33,8 @@ def parse_noqa(code): for lineno, line in enumerate(code, start=1): match = NOQA_REGEXP.search(line) if match: - for error_code in _parse_error_codes(match): - error_code = NOQA_CODE_MAP.get(error_code, error_code) + for raw_error_code in _parse_error_codes(match): + error_code = NOQA_CODE_MAP.get(raw_error_code, raw_error_code) noqa_lines[error_code].add(lineno) return noqa_lines diff --git a/vulture/utils.py b/vulture/utils.py index 121239de..832b2a2d 100644 --- a/vulture/utils.py +++ b/vulture/utils.py @@ -88,8 +88,8 @@ def get_modules(paths): """ modules = [] - for path in paths: - path = path.resolve() + for given_path in paths: + path = given_path.resolve() if path.is_file(): if path.suffix == ".pyc": sys.exit(f"Error: *.pyc files are not supported: {path}")