Skip to content

Commit

Permalink
Update ruff settings; update hooks (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefmolin authored Oct 27, 2024
1 parent 2393fde commit bc4b8a2
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 21 deletions.
12 changes: 9 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.7
rev: v0.7.1
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
Expand All @@ -20,8 +20,14 @@ repos:
- id: numpydoc-validation
exclude: (tests/|docs/).*

- repo: https://github.com/econchick/interrogate
rev: 1.7.0
hooks:
- id: interrogate
files: tests/.*

- repo: https://github.com/tox-dev/pyproject-fmt
rev: 2.2.1
rev: v2.4.3
hooks:
- id: pyproject-fmt
args: [--keep-full-version, --no-print-diff]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</td>
</tr>
</table>

<hr>
</div>

Expand All @@ -58,7 +58,7 @@ Add the following to your `.pre-commit-config.yaml` file:

```yaml
- repo: https://github.com/stefmolin/exif-stripper
rev: 0.4.0
rev: 0.5.0
hooks:
- id: strip-exif
```
Expand Down
8 changes: 4 additions & 4 deletions logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 16 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,28 @@ version = { attr = "exif_stripper.__version__" }
line-length = 88
format.indent-style = "space"
format.quote-style = "single"
format.docstring-code-format = true
lint.select = [
"B", # flake8-bugbear rules
"C", # mccabe rules
"E", # pycodestyle error rules
"F", # pyflakes rules
"I", # isort rules
"W", # pycodestyle warning rules
"ANN", # flake8-annotations
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"E", # pycodestyle error
"ERA", # eradicate (commented out code)
"F", # pyflakes
"FA", # flake8-future-annotations
"I", # isort
"N", # pep8-naming
"PTH", # flake8-use-pathlib
"SIM", # flake8-simplify
"TRY", # tryceratops
"UP", # pyupgrade
"W", # pycodestyle warning
]
lint.ignore = [
"C901", # max-complexity-10
"E501", # line-too-long
]

lint.extend-per-file-ignores."tests/*" = [ "ANN" ] # don't require annotations for tests
lint.isort.known-first-party = [
"exif_stripper",
]
Expand Down
2 changes: 1 addition & 1 deletion src/exif_stripper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from PIL import Image, UnidentifiedImageError

__version__ = '0.4.0'
__version__ = '0.5.0'


def process_image(filename: str | os.PathLike) -> bool:
Expand Down
7 changes: 3 additions & 4 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import platform
import subprocess
import sys
from contextlib import suppress
from getpass import getuser

import pytest
Expand Down Expand Up @@ -33,16 +34,14 @@ def image_with_exif_data(tmp_path):
def image_with_metadata(image_with_exif_data):
"""Fixture for an image with metadata."""
if RUNNING_ON in ['Darwin', 'Linux']:
try:
with suppress(OSError):
# OSError raised if filesystem does not support extended attributes
xattr(image_with_exif_data).set(
f'{getuser()}.test_extended_attribute'
if RUNNING_ON == 'Linux'
else 'com.apple.macl',
b'\x00',
)
except OSError: # pragma: nocover
# filesystem does not support extended attributes
pass
return image_with_exif_data


Expand Down

0 comments on commit bc4b8a2

Please sign in to comment.