Skip to content

Commit

Permalink
Add ruff linter to pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss committed May 28, 2024
1 parent 73e94c5 commit 32044da
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
15 changes: 11 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
# Identify invalid files
- id: check-ast
Expand All @@ -17,7 +17,6 @@ repos:
- id: check-docstring-first
- id: debug-statements
- id: requirements-txt-fixer
- id: fix-encoding-pragma
- id: fix-byte-order-marker
# General quality checks
- id: mixed-line-ending
Expand All @@ -29,12 +28,20 @@ repos:
- id: check-executables-have-shebangs
- id: end-of-file-fixer
exclude: ^test/resources/.+

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.5
hooks:
- id: ruff
args: [--extend-ignore, "F401,F403"]

- repo: https://github.com/ambv/black
rev: 24.1.1
rev: 24.4.2
hooks:
- id: black
args: [--config=.black.toml]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.8.0'
rev: 'v1.10.0'
hooks:
- id: mypy
14 changes: 4 additions & 10 deletions test/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,11 @@ def test_what_from_string_py311(expected, h):
"expected, h",
[
("jpeg", b"______Exif"),
("jpeg", b"______Exif"),
("jpeg", b"______JFIF"),
("jpeg", b"______JFIF"),
("tiff", "4949"),
("tiff", "49495c7832615c783030"),
("tiff", "4d4d"),
("tiff", "4d4d5c7830305c783261"),
("tiff", b"II"), # bytes.fromhex('4949')
("tiff", b"II\\x2a\\x00"), # bytes.fromhex('49495c7832615c783030')
("tiff", b"MM"), # bytes.fromhex('4d4d')
("tiff", b"MM\\x00\\x2a"), # bytes.fromhex('4d4d5c7830305c783261')
("tiff", b"II"),
("tiff", b"II\\x2a\\x00"), # bytes.fromhex((b'49495c7832615c783030')
("tiff", b"MM"),
("tiff", b"MM\\x00\\x2a"), # bytes.fromhex((b'4d4d5c7830305c783261')
],
)
@pytest.mark.parametrize("imghdr_strict", [True, False])
Expand Down

0 comments on commit 32044da

Please sign in to comment.