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

View File

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

View File

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

View File

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