Skip to content

Commit

Permalink
chore: extend ruff settings
Browse files Browse the repository at this point in the history
  • Loading branch information
boidolr committed Oct 15, 2023
1 parent b92b019 commit f8d7661
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pre_commit_images/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def optimize_single_image(source: Path, temp: IO[bytes]) -> None:
try:
with TemporaryFile() as temp:
optimize_single_image(Path(image), temp)
except Exception as exc:
except Exception as exc: # noqa: PERF203
print(
f"Failed optimization for {image} ({exc})",
file=sys.stderr,
Expand Down
10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,18 @@ select = [
"S",
# flake8-comprehensions
"C4",
# flake8-logging-format
"G",
# flake8-annotations
"ANN",
# flake8-simplify
"SIM",
# flake8-pytest-style
"PT",
# flake8-tidy-imports (relative-imports)
"TID252",
# Perflint
"PERF",
# flynt
"FLY",
# isort
Expand Down
6 changes: 3 additions & 3 deletions tests/optimize_avif_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pre_commit_images.optimize_avif import main


@pytest.fixture
@pytest.fixture()
def images(tmpdir):
test_file = pathlib.Path(__file__).parent / "test.avif"
path = pathlib.Path(tmpdir) / "test.avif"
Expand All @@ -24,8 +24,8 @@ def test_qmin_qmax_and_quality(images):
path, _ = images
with pytest.raises(SystemExit) as wrapped_exit:
assert main(("-min", "10", "--quality", "20", str(path))) == 1
assert wrapped_exit.type == SystemExit
assert wrapped_exit.value.code == 1
assert wrapped_exit.type == SystemExit
assert wrapped_exit.value.code == "Can not use both `qmin`/`qmax` and `quality`"


def test_compress_avif(images):
Expand Down
2 changes: 1 addition & 1 deletion tests/optimize_jpg_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pre_commit_images.optimize_jpg import main


@pytest.fixture
@pytest.fixture()
def images(tmpdir):
image = "test.jpg"
path = pathlib.Path(tmpdir) / image
Expand Down
2 changes: 1 addition & 1 deletion tests/optimize_png_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pre_commit_images.optimize_png import main


@pytest.fixture
@pytest.fixture()
def images(tmpdir):
image = "test.png"
path = pathlib.Path(tmpdir) / image
Expand Down
2 changes: 1 addition & 1 deletion tests/optimize_svg_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pre_commit_images.optimize_svg import main


@pytest.fixture
@pytest.fixture()
def images(tmpdir):
image = "test.svg"
path = pathlib.Path(tmpdir) / image
Expand Down
2 changes: 1 addition & 1 deletion tests/optimize_webp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pre_commit_images.optimize_webp import main


@pytest.fixture
@pytest.fixture()
def images(tmpdir):
image = "test.webp"
path = pathlib.Path(tmpdir) / image
Expand Down

0 comments on commit f8d7661

Please sign in to comment.