Skip to content

Commit

Permalink
Replace flake8 with ruff.
Browse files Browse the repository at this point in the history
  • Loading branch information
wschott committed Oct 13, 2023
1 parent e2e6118 commit 360f3ed
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 34 deletions.
6 changes: 0 additions & 6 deletions .flake8

This file was deleted.

30 changes: 7 additions & 23 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
exclude: ^tests/fixtures/
Expand All @@ -11,34 +11,18 @@ repos:
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: pyupgrade
args: [ --py310-plus ]

- repo: https://github.com/asottile/reorder_python_imports
rev: v3.9.0
hooks:
- id: reorder-python-imports
args: [ --py310-plus, --application-directories, '.:src' ]

- repo: https://github.com/psf/black
rev: 23.1.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.9.1
hooks:
- id: black

- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.292
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- flake8-comprehensions
- flake8-simplify
- id: ruff

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.991
rev: v1.6.0
hooks:
- id: mypy
additional_dependencies:
Expand Down
2 changes: 2 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@
- dynamic version: https://github.com/pypa/setuptools_scm
- Python 3.11+
- use built-in StrEnum
- Python 3.12+
- @override (~typing_extensions 4.4.0)
17 changes: 15 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ dev = [
"pre-commit",
"tox",
"pytest",
"mypy",
"flake8",
"black",
"ruff",
"mypy",
]

[project.urls]
Expand Down Expand Up @@ -61,6 +61,19 @@ source = [
show_missing = true


[tool.ruff]
line-length = 88
select = [
"E", # pycodestyle
"F", # pyflakes
"B", # flake8-bugbear
"SIM", # flake8-simplify
"UP", # pyupgrade
"TRY", # tryceratops
]
ignore = ["E501", "B904", "TRY003", "TRY200"]


[tool.mypy] # TODO
python_version = "3.10"
no_implicit_optional = true
Expand Down
2 changes: 1 addition & 1 deletion tests/store/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def test_download_artwork():
with patch("urllib.request.urlopen", return_value=mock):
artwork = download_artwork("any-url")

assert b"artwork-content", MimeType.JPEG == artwork
assert b"artwork-content", artwork == MimeType.JPEG


def test_download_artwork_with_url_error():
Expand Down
4 changes: 2 additions & 2 deletions tests/test_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ def test_action_init():
with pytest.raises(NotImplementedError):
action.apply()
with pytest.raises(NotImplementedError):
action.needs_confirmation
action.needs_confirmation # noqa: B018
with pytest.raises(NotImplementedError):
action.actionable
action.actionable # noqa: B018


def test_action_mark_as_success():
Expand Down

0 comments on commit 360f3ed

Please sign in to comment.