Switch ling to ruff.

This commit is contained in:
Mikaël Capelle 2024-05-03 21:13:54 +02:00
parent a953ff343c
commit 8b0a5df79a
4 changed files with 12 additions and 18 deletions

View File

@ -36,19 +36,14 @@ extend-ignore = ['E203', 'E231']
manga-scan = "holt59.scans.__main__:main"
[tool.poe.tasks]
lint-black = "black --check --diff src typings"
lint-isort = "isort -c src typings"
lint-mypy = "mypy src typings"
format-imports = "ruff check --select I src typings --fix"
format-ruff = "ruff format src typings"
format.sequence = ["format-imports", "format-ruff"]
lint-ruff = "ruff check src typings"
lint-ruff-format = "ruff format --check src typings"
lint-pyright = "pyright src typings"
lint-all.sequence = [
"lint-black",
"lint-isort",
"lint-mypy",
"lint-ruff",
"lint-pyright",
]
lint-all.ignore_fail = "return_non_zero"
lint.sequence = ["lint-ruff", "lint-ruff-format", "lint-pyright"]
lint.ignore_fail = "return_non_zero"
[tool.isort]
profile = "black"
@ -67,6 +62,9 @@ ignore_missing_imports = true
line-length = 88
target-version = "py311"
[tool.ruff.lint]
extend-select = ["B", "Q", "I"]
[tool.pyright]
exclude = ["lib", "**/.*", "venv", "build"]
typeCheckingMode = "strict"

View File

@ -35,7 +35,7 @@ def fetch_chapters(
fetcher: ScanFetcher[_MangaT, _ChapterT],
name: str,
folder: Path,
ignore: set[str] = set(),
ignore: frozenset[str] = frozenset(),
):
manga = fetcher.find_manga(name)
assert manga is not None
@ -67,7 +67,7 @@ def fetch_chapters(
)
def parse_ignore(value: str) -> set[str]:
def parse_ignore(value: str) -> frozenset[str]:
"""
Parse a set of ignore numbers.
@ -94,7 +94,7 @@ def parse_ignore(value: str) -> set[str]:
except ValueError:
ignore.add(part)
return ignore
return frozenset(ignore)
def main() -> None:

View File

@ -1,5 +1,3 @@
# -*- encoding: utf-8 -*-
import logging
import tempfile
import urllib.error

View File

@ -1,5 +1,3 @@
# -*- encoding: utf-8 -*-
import re
from abc import abstractmethod
from dataclasses import dataclass