Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pre-commit config #295

Merged
merged 4 commits into from Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 11 additions & 7 deletions .pre-commit-config.yaml
Expand Up @@ -20,12 +20,6 @@ repos:
- --add-import
- from __future__ import annotations

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.2.2
hooks:
- id: ruff
- id: ruff-format

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.1
hooks:
Expand All @@ -45,7 +39,17 @@ repos:
hooks:
- id: validate-pyproject

- repo: https://github.com/psf/black
rev: "24.2.0"
hooks:
- id: black

- repo: https://github.com/pycqa/autoflake
rev: v2.3.0
hooks:
- id: autoflake

- repo: https://github.com/fsouza/mirrors-pyright
rev: v1.1.350
rev: v1.1.353
hooks:
- id: pyright
8 changes: 4 additions & 4 deletions autoflake.py
Expand Up @@ -575,7 +575,8 @@ def filter_code(
undefined_names: list[str] = []
if expand_star_imports and not (
# See explanations in #18.
re.search(r"\b__all__\b", source) or re.search(r"\bdel\b", source)
re.search(r"\b__all__\b", source)
or re.search(r"\bdel\b", source)
):
marked_star_import_line_numbers = frozenset(
star_import_used_line_numbers(messages),
Expand Down Expand Up @@ -1514,9 +1515,8 @@ def _main(
if not success:
return 1

if (
args["remove_rhs_for_unused_variables"]
and not (args["remove_unused_variables"])
if args["remove_rhs_for_unused_variables"] and not (
args["remove_unused_variables"]
):
_LOGGER.error(
"Using --remove-rhs-for-unused-variables only makes sense when "
Expand Down
3 changes: 0 additions & 3 deletions test_autoflake.py
Expand Up @@ -33,7 +33,6 @@


class UnitTests(unittest.TestCase):

"""Unit tests."""

def test_imports(self) -> None:
Expand Down Expand Up @@ -2005,7 +2004,6 @@ def test_exclude(self) -> None:


class SystemTests(unittest.TestCase):

"""System tests."""

def test_skip_file(self) -> None:
Expand Down Expand Up @@ -3611,7 +3609,6 @@ def temporary_directory(directory: str = ".", prefix: str = "tmp.") -> Iterator[


class StubFile:

"""Fake file that ignores everything."""

def write(*_: Any) -> None:
Expand Down