switch to ruff and update justfile
Signed-off-by: Ivan Schaller <ivan@schaller.sh>
This commit is contained in:
parent
c684290c92
commit
2ad0c575a7
8 changed files with 111 additions and 127 deletions
|
@ -26,7 +26,7 @@ pipeline:
|
||||||
branch: master
|
branch: master
|
||||||
event: pull_request
|
event: pull_request
|
||||||
commands:
|
commands:
|
||||||
- python3 -m hatch build --clean
|
- just test_build
|
||||||
|
|
||||||
# create release-notes
|
# create release-notes
|
||||||
test-create-release-notes:
|
test-create-release-notes:
|
||||||
|
|
|
@ -26,4 +26,4 @@ pipeline:
|
||||||
branch: master
|
branch: master
|
||||||
event: pull_request
|
event: pull_request
|
||||||
commands:
|
commands:
|
||||||
- python3 -m tox
|
- just test_tox
|
||||||
|
|
|
@ -29,4 +29,4 @@ pipeline:
|
||||||
- grep -v img2pdf contrib/requirements_dev.txt > contrib/requirements_dev_arm64.txt
|
- grep -v img2pdf contrib/requirements_dev.txt > contrib/requirements_dev_arm64.txt
|
||||||
- rm -f contrib/requirements_dev.txt
|
- rm -f contrib/requirements_dev.txt
|
||||||
- mv contrib/requirements_dev_arm64.txt contrib/requirements_dev.txt
|
- mv contrib/requirements_dev_arm64.txt contrib/requirements_dev.txt
|
||||||
- python3 -m tox
|
- just test_tox
|
||||||
|
|
|
@ -17,51 +17,28 @@ pipeline:
|
||||||
image: cr.44net.ch/ci-plugins/tests
|
image: cr.44net.ch/ci-plugins/tests
|
||||||
pull: true
|
pull: true
|
||||||
commands:
|
commands:
|
||||||
- shfmt -d -i 4 -bn -ci -sr .
|
- just test_shfmt
|
||||||
|
|
||||||
# check code style - python
|
# check code style - python
|
||||||
test-black:
|
test-black:
|
||||||
image: cr.44net.ch/ci-plugins/tests
|
image: cr.44net.ch/ci-plugins/tests
|
||||||
pull: true
|
pull: true
|
||||||
commands:
|
commands:
|
||||||
- python3 -m black --check --diff .
|
- just test_black
|
||||||
|
|
||||||
# check imports - python
|
|
||||||
test-isort:
|
|
||||||
image: cr.44net.ch/ci-plugins/tests
|
|
||||||
pull: true
|
|
||||||
commands:
|
|
||||||
- python3 -m isort --check-only --diff .
|
|
||||||
|
|
||||||
# check unused and missing imports - python
|
|
||||||
test-autoflake:
|
|
||||||
image: cr.44net.ch/ci-plugins/tests
|
|
||||||
pull: true
|
|
||||||
commands:
|
|
||||||
- python3 -m autoflake --remove-all-unused-imports -r -v mangadlp/
|
|
||||||
- python3 -m autoflake --check --remove-all-unused-imports -r -v mangadlp/
|
|
||||||
|
|
||||||
# check static typing - python
|
# check static typing - python
|
||||||
test-mypy:
|
test-mypy:
|
||||||
image: cr.44net.ch/ci-plugins/tests
|
image: cr.44net.ch/ci-plugins/tests
|
||||||
pull: true
|
pull: true
|
||||||
commands:
|
commands:
|
||||||
- python3 -m mypy --install-types --non-interactive mangadlp/
|
- just test_mypy
|
||||||
|
|
||||||
# mccabe, pycodestyle, pyflakes tests - python
|
# ruff test - python
|
||||||
test-pylama:
|
|
||||||
image: cr.44net.ch/ci-plugins/tests
|
|
||||||
pull: true
|
|
||||||
commands:
|
|
||||||
- python3 -m pylama mangadlp/
|
|
||||||
|
|
||||||
# pylint test - python
|
|
||||||
test-pylint:
|
test-pylint:
|
||||||
image: cr.44net.ch/ci-plugins/tests
|
image: cr.44net.ch/ci-plugins/tests
|
||||||
pull: true
|
pull: true
|
||||||
commands:
|
commands:
|
||||||
- python3 -m pip install -r requirements.txt
|
- just test_ruff
|
||||||
- python3 -m pylint --fail-under 9 mangadlp/
|
|
||||||
|
|
||||||
# test mkdocs generation
|
# test mkdocs generation
|
||||||
test-mkdocs:
|
test-mkdocs:
|
||||||
|
@ -72,14 +49,14 @@ pipeline:
|
||||||
- cd docs || exit 1
|
- cd docs || exit 1
|
||||||
- python3 -m mkdocs build --strict
|
- python3 -m mkdocs build --strict
|
||||||
|
|
||||||
# test code with different python versions - python
|
# test code with pytest - python
|
||||||
test-tox-pytest:
|
test-tox-pytest:
|
||||||
when:
|
when:
|
||||||
event: [ push ]
|
event: [ push ]
|
||||||
image: cr.44net.ch/ci-plugins/tests
|
image: cr.44net.ch/ci-plugins/tests
|
||||||
pull: true
|
pull: true
|
||||||
commands:
|
commands:
|
||||||
- python3 -m tox -e basic
|
- just test_pytest
|
||||||
|
|
||||||
# generate coverage report - python
|
# generate coverage report - python
|
||||||
test-tox-coverage:
|
test-tox-coverage:
|
||||||
|
@ -89,7 +66,7 @@ pipeline:
|
||||||
image: cr.44net.ch/ci-plugins/tests
|
image: cr.44net.ch/ci-plugins/tests
|
||||||
pull: true
|
pull: true
|
||||||
commands:
|
commands:
|
||||||
- python3 -m tox -e coverage
|
- just test_coverage
|
||||||
|
|
||||||
# analyse code with sonarqube and upload it
|
# analyse code with sonarqube and upload it
|
||||||
sonarqube-analysis:
|
sonarqube-analysis:
|
||||||
|
|
|
@ -14,9 +14,6 @@ hatchling>=1.11.0
|
||||||
pytest>=7.0.0
|
pytest>=7.0.0
|
||||||
coverage>=6.3.1
|
coverage>=6.3.1
|
||||||
black>=22.1.0
|
black>=22.1.0
|
||||||
isort>=5.10.0
|
|
||||||
pylint>=2.13.0
|
|
||||||
mypy>=0.940
|
mypy>=0.940
|
||||||
tox>=3.24.5
|
tox>=3.24.5
|
||||||
autoflake>=1.4
|
ruff>=0.0.247
|
||||||
pylama>=8.3.8
|
|
||||||
|
|
53
justfile
53
justfile
|
@ -68,45 +68,39 @@ create_venv:
|
||||||
@python3 -m venv venv
|
@python3 -m venv venv
|
||||||
|
|
||||||
install_deps:
|
install_deps:
|
||||||
|
@echo "installing dependencies"
|
||||||
|
@pip3 install -r requirements.txt
|
||||||
|
|
||||||
|
install_deps_dev:
|
||||||
@echo "installing dependencies"
|
@echo "installing dependencies"
|
||||||
@pip3 install -r contrib/requirements_dev.txt
|
@pip3 install -r contrib/requirements_dev.txt
|
||||||
|
|
||||||
test_shfmt:
|
test_shfmt:
|
||||||
@find . -type f \( -name "**.sh" -and -not -path "./venv/*" -and -not -path "./.tox/*" \) -exec shfmt -d -i 4 -bn -ci -sr "{}" \+;
|
@find . -type f \( -name "**.sh" -and -not -path "./.**" -and -not -path "./venv**" \) -exec shfmt -d -i 4 -bn -ci -sr "{}" \+;
|
||||||
|
|
||||||
test_black:
|
test_black:
|
||||||
@python3 -m black --check --diff .
|
@python3 -m black --check --diff .
|
||||||
|
|
||||||
test_isort:
|
|
||||||
@python3 -m isort --check-only --diff .
|
|
||||||
|
|
||||||
test_mypy:
|
test_mypy:
|
||||||
@python3 -m mypy --install-types --non-interactive mangadlp/
|
@python3 -m mypy --install-types --non-interactive --ignore-missing-imports .
|
||||||
|
|
||||||
|
test_ruff:
|
||||||
|
@python3 -m ruff --diff .
|
||||||
|
|
||||||
|
test_ci_conf:
|
||||||
|
@woodpecker-cli lint .woodpecker/
|
||||||
|
|
||||||
test_pytest:
|
test_pytest:
|
||||||
@python3 -m tox -e basic
|
@python3 -m tox -e basic
|
||||||
|
|
||||||
test_autoflake:
|
test_coverage:
|
||||||
@python3 -m autoflake --remove-all-unused-imports -r -v mangadlp/
|
@python3 -m tox -e coverage
|
||||||
@python3 -m autoflake --check --remove-all-unused-imports -r -v mangadlp/
|
|
||||||
|
|
||||||
test_pylama:
|
|
||||||
@python3 -m pylama --options tox.ini mangadlp/
|
|
||||||
|
|
||||||
test_pylint:
|
|
||||||
@python3 -m pylint --fail-under 9 mangadlp/
|
|
||||||
|
|
||||||
test_tox:
|
test_tox:
|
||||||
@python3 -m tox
|
@python3 -m tox
|
||||||
|
|
||||||
test_tox_coverage:
|
|
||||||
@python3 -m tox -e coverage
|
|
||||||
|
|
||||||
test_build:
|
test_build:
|
||||||
@python3 -m hatch build
|
@python3 -m hatch build --clean
|
||||||
|
|
||||||
test_ci_conf:
|
|
||||||
@woodpecker-cli lint .woodpecker/
|
|
||||||
|
|
||||||
test_docker_build:
|
test_docker_build:
|
||||||
@docker build . -f docker/Dockerfile.amd64 -t manga-dlp:test
|
@docker build . -f docker/Dockerfile.amd64 -t manga-dlp:test
|
||||||
|
@ -123,11 +117,8 @@ lint:
|
||||||
-just test_ci_conf
|
-just test_ci_conf
|
||||||
just test_shfmt
|
just test_shfmt
|
||||||
just test_black
|
just test_black
|
||||||
just test_isort
|
|
||||||
just test_mypy
|
just test_mypy
|
||||||
just test_autoflake
|
just test_ruff
|
||||||
just test_pylama
|
|
||||||
just test_pylint
|
|
||||||
@echo -e "\n\033[0;32m=== ALL DONE ===\033[0m\n"
|
@echo -e "\n\033[0;32m=== ALL DONE ===\033[0m\n"
|
||||||
|
|
||||||
tests:
|
tests:
|
||||||
|
@ -135,11 +126,8 @@ tests:
|
||||||
-just test_ci_conf
|
-just test_ci_conf
|
||||||
just test_shfmt
|
just test_shfmt
|
||||||
just test_black
|
just test_black
|
||||||
just test_isort
|
|
||||||
just test_mypy
|
just test_mypy
|
||||||
just test_autoflake
|
just test_ruff
|
||||||
just test_pylama
|
|
||||||
just test_pylint
|
|
||||||
just test_pytest
|
just test_pytest
|
||||||
@echo -e "\n\033[0;32m=== ALL DONE ===\033[0m\n"
|
@echo -e "\n\033[0;32m=== ALL DONE ===\033[0m\n"
|
||||||
|
|
||||||
|
@ -148,13 +136,10 @@ tests_full:
|
||||||
-just test_ci_conf
|
-just test_ci_conf
|
||||||
just test_shfmt
|
just test_shfmt
|
||||||
just test_black
|
just test_black
|
||||||
just test_isort
|
|
||||||
just test_mypy
|
just test_mypy
|
||||||
just test_autoflake
|
just test_ruff
|
||||||
just test_pylama
|
|
||||||
just test_pylint
|
|
||||||
just test_build
|
just test_build
|
||||||
just test_tox
|
just test_tox
|
||||||
just test_tox_coverage
|
just test_coverage
|
||||||
just test_docker_build
|
just test_docker_build
|
||||||
@echo -e "\n\033[0;32m=== ALL DONE ===\033[0m\n"
|
@echo -e "\n\033[0;32m=== ALL DONE ===\033[0m\n"
|
||||||
|
|
130
pyproject.toml
130
pyproject.toml
|
@ -1,5 +1,5 @@
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["hatchling>=1.11.0"]
|
requires = ["hatchling>=1.11.0"]
|
||||||
build-backend = "hatchling.build"
|
build-backend = "hatchling.build"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
|
@ -9,14 +9,8 @@ description = "A cli manga downloader"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
requires-python = ">=3.8"
|
requires-python = ">=3.8"
|
||||||
authors = [
|
authors = [{ name = "Ivan Schaller", email = "ivan@schaller.sh" }]
|
||||||
{ name = "Ivan Schaller", email = "ivan@schaller.sh" },
|
keywords = ["manga", "downloader", "mangadex"]
|
||||||
]
|
|
||||||
keywords = [
|
|
||||||
"manga",
|
|
||||||
"downloader",
|
|
||||||
"mangadex",
|
|
||||||
]
|
|
||||||
classifiers = [
|
classifiers = [
|
||||||
"License :: OSI Approved :: MIT License",
|
"License :: OSI Approved :: MIT License",
|
||||||
"Natural Language :: English",
|
"Natural Language :: English",
|
||||||
|
@ -30,17 +24,17 @@ dependencies = [
|
||||||
"loguru>=0.6.0",
|
"loguru>=0.6.0",
|
||||||
"click>=8.1.3",
|
"click>=8.1.3",
|
||||||
"click-option-group>=0.5.5",
|
"click-option-group>=0.5.5",
|
||||||
"xmltodict>=0.13.0"
|
"xmltodict>=0.13.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
Homepage = "https://github.com/olofvndrhr/manga-dlp"
|
Homepage = "https://github.com/olofvndrhr/manga-dlp"
|
||||||
History = "https://github.com/olofvndrhr/manga-dlp/commits/master"
|
History = "https://github.com/olofvndrhr/manga-dlp/commits/master"
|
||||||
Tracker = "https://github.com/olofvndrhr/manga-dlp/issues"
|
Tracker = "https://github.com/olofvndrhr/manga-dlp/issues"
|
||||||
Source = "https://github.com/olofvndrhr/manga-dlp"
|
Source = "https://github.com/olofvndrhr/manga-dlp"
|
||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
mangadlp = "mangadlp.cli:main"
|
mangadlp = "mangadlp.cli:main"
|
||||||
manga-dlp = "mangadlp.cli:main"
|
manga-dlp = "mangadlp.cli:main"
|
||||||
|
|
||||||
[tool.hatch.version]
|
[tool.hatch.version]
|
||||||
|
@ -69,44 +63,89 @@ dependencies = [
|
||||||
"pytest>=7.0.0",
|
"pytest>=7.0.0",
|
||||||
"coverage>=6.3.1",
|
"coverage>=6.3.1",
|
||||||
"black>=22.1.0",
|
"black>=22.1.0",
|
||||||
"isort>=5.10.0",
|
|
||||||
"pylint>=2.13.0",
|
|
||||||
"mypy>=0.940",
|
"mypy>=0.940",
|
||||||
"tox>=3.24.5",
|
"tox>=3.24.5",
|
||||||
"autoflake>=1.4",
|
"ruff>=0.0.247",
|
||||||
"pylama>=8.3.8",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.isort]
|
# mypy
|
||||||
py_version = 39
|
|
||||||
skip_gitignore = true
|
|
||||||
line_length = 88
|
|
||||||
profile = "black"
|
|
||||||
multi_line_output = 3
|
|
||||||
include_trailing_comma = true
|
|
||||||
use_parentheses = true
|
|
||||||
|
|
||||||
[tool.mypy]
|
[tool.mypy]
|
||||||
python_version = "3.9"
|
#strict = true
|
||||||
disallow_untyped_defs = false
|
python_version = "3.9"
|
||||||
follow_imports = "normal"
|
disallow_untyped_defs = false
|
||||||
|
follow_imports = "normal"
|
||||||
ignore_missing_imports = true
|
ignore_missing_imports = true
|
||||||
warn_no_return = false
|
warn_no_return = false
|
||||||
warn_unused_ignores = true
|
warn_unused_ignores = true
|
||||||
show_error_context = true
|
show_error_context = true
|
||||||
show_column_numbers = true
|
show_column_numbers = true
|
||||||
show_error_codes = true
|
show_error_codes = true
|
||||||
pretty = true
|
pretty = true
|
||||||
no_implicit_optional = false
|
no_implicit_optional = false
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
# ruff
|
||||||
pythonpath = [
|
|
||||||
"."
|
[tool.ruff]
|
||||||
|
target-version = "py39"
|
||||||
|
select = [
|
||||||
|
"E", # pycodetyle err
|
||||||
|
"W", # pycodetyle warn
|
||||||
|
"D", # pydocstyle
|
||||||
|
"C90", # mccabe
|
||||||
|
"I", # isort
|
||||||
|
"PLE", # pylint err
|
||||||
|
"PLW", # pylint warn
|
||||||
|
"PLC", # pylint convention
|
||||||
|
"PLR", # pylint refactor
|
||||||
|
"F", # pyflakes
|
||||||
|
"RUF", # ruff specific
|
||||||
|
]
|
||||||
|
line-length = 88
|
||||||
|
fix = true
|
||||||
|
format = "grouped"
|
||||||
|
ignore-init-module-imports = true
|
||||||
|
respect-gitignore = true
|
||||||
|
ignore = ["E501", "D103", "D100"]
|
||||||
|
exclude = [
|
||||||
|
".direnv",
|
||||||
|
".git",
|
||||||
|
".mypy_cache",
|
||||||
|
".ruff_cache",
|
||||||
|
".svn",
|
||||||
|
".venv",
|
||||||
|
"venv",
|
||||||
|
"__pypackages__",
|
||||||
|
"build",
|
||||||
|
"dist",
|
||||||
|
"venv",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[tool.ruff.per-file-ignores]
|
||||||
|
"__init__.py" = ["D104"]
|
||||||
|
|
||||||
|
[tool.ruff.pylint]
|
||||||
|
max-args = 10
|
||||||
|
|
||||||
|
[tool.ruff.mccabe]
|
||||||
|
max-complexity = 10
|
||||||
|
|
||||||
|
[tool.ruff.pydocstyle]
|
||||||
|
convention = "google"
|
||||||
|
|
||||||
|
[tool.ruff.pycodestyle]
|
||||||
|
max-doc-length = 88
|
||||||
|
|
||||||
|
# pytest
|
||||||
|
|
||||||
|
[tool.pytest.ini_options]
|
||||||
|
pythonpath = ["."]
|
||||||
|
|
||||||
|
# coverage
|
||||||
|
|
||||||
[tool.coverage.run]
|
[tool.coverage.run]
|
||||||
source = ["mangadlp"]
|
source = ["mangadlp"]
|
||||||
branch = true
|
branch = true
|
||||||
command_line = "-m pytest --exitfirst"
|
command_line = "-m pytest --exitfirst"
|
||||||
|
|
||||||
[tool.coverage.report]
|
[tool.coverage.report]
|
||||||
|
@ -127,12 +166,3 @@ exclude_lines = [
|
||||||
"@(abc.)?abstractmethod",
|
"@(abc.)?abstractmethod",
|
||||||
]
|
]
|
||||||
ignore_errors = true
|
ignore_errors = true
|
||||||
|
|
||||||
[tool.pylint.main]
|
|
||||||
py-version = "3.9"
|
|
||||||
|
|
||||||
[tool.pylint.logging]
|
|
||||||
logging-modules = ["logging", "loguru"]
|
|
||||||
disable = "C0301, C0114, C0116, W0703, R0902, R0913, E0401, W1203"
|
|
||||||
good-names = "r"
|
|
||||||
logging-format-style = "new"
|
|
||||||
|
|
5
tox.ini
5
tox.ini
|
@ -24,8 +24,3 @@ commands =
|
||||||
coverage erase
|
coverage erase
|
||||||
coverage run
|
coverage run
|
||||||
coverage xml -i
|
coverage xml -i
|
||||||
|
|
||||||
[pylama]
|
|
||||||
format = pycodestyle
|
|
||||||
linters = mccabe,pycodestyle,pyflakes
|
|
||||||
ignore = E501,C901,C0301
|
|
||||||
|
|
Loading…
Reference in a new issue