Skip to content

Commit

Permalink
Replace Black and isort with Ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
phyrwork committed Aug 28, 2024
1 parent 9569195 commit e1e8c99
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 73 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,8 @@ jobs:
- name: Install dependencies
run: uv sync

- name: Check code style
run: uv run black --check .

- name: Check imports order
run: uv run isort --check .
- name: Lint and check code format
run: uv run ruff check

- name: Check types
run: uv run mypy .
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ copyright = "copyright2.app:main"
dev-dependencies = [
"pytest~=8.2.2",
"pytest-runner~=6.0.1",
"black~=24.4.2",
"isort~=5.13.2",
"mypy~=1.11.2",
"types-pyyaml~=6.0.12.20240808",
"ruff>=0.6.2",
]

[tool.isort]
Expand Down
2 changes: 1 addition & 1 deletion src/copyright2/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def process(file: fs.File) -> None:
tmp.writelines(f.apply(text, updates))

os.rename(tmp.name, file.path)
cli.echo(f" ok")
cli.echo(" ok")
num_fixed += 1

for i, file in enumerate(app.list_files(), start=1):
Expand Down
2 changes: 1 addition & 1 deletion src/copyright2/timestamps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import re
from functools import cached_property, reduce
from itertools import chain, zip_longest
from typing import Any, Iterable, Iterator, Literal, Set, Tuple, TypeAlias, Union
from typing import Iterable, Iterator, Literal, Set, Tuple, TypeAlias, Union


class Int(int):
Expand Down
6 changes: 3 additions & 3 deletions tests/test_filesystem.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from pathlib import Path

from copyright2 import configs as cfg
from copyright2 import filesystem as fs

EXAMPLES = Path(__file__).parent.parent / "examples"

if not EXAMPLES.is_dir():
raise ValueError(f"examples directory {EXAMPLES.resolve()} not found")

from copyright2 import configs as cfg
from copyright2 import filesystem as fs


def test_iter_subdirs_example() -> None:
files = {}
Expand Down
88 changes: 27 additions & 61 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e1e8c99

Please sign in to comment.