switch to ruff and update justfile

Signed-off-by: Ivan Schaller <ivan@schaller.sh>
This commit is contained in:
Ivan Schaller 2023-02-18 12:23:50 +01:00
parent c684290c92
commit 2ad0c575a7
Signed by: olofvndrhr
GPG key ID: 2A6BE07D99C8C205
8 changed files with 111 additions and 127 deletions

View file

@ -26,7 +26,7 @@ pipeline:
branch: master
event: pull_request
commands:
- python3 -m hatch build --clean
- just test_build
# create release-notes
test-create-release-notes:

View file

@ -26,4 +26,4 @@ pipeline:
branch: master
event: pull_request
commands:
- python3 -m tox
- just test_tox

View file

@ -29,4 +29,4 @@ pipeline:
- grep -v img2pdf contrib/requirements_dev.txt > contrib/requirements_dev_arm64.txt
- rm -f contrib/requirements_dev.txt
- mv contrib/requirements_dev_arm64.txt contrib/requirements_dev.txt
- python3 -m tox
- just test_tox

View file

@ -17,51 +17,28 @@ pipeline:
image: cr.44net.ch/ci-plugins/tests
pull: true
commands:
- shfmt -d -i 4 -bn -ci -sr .
- just test_shfmt
# check code style - python
test-black:
image: cr.44net.ch/ci-plugins/tests
pull: true
commands:
- python3 -m black --check --diff .
# 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/
- just test_black
# check static typing - python
test-mypy:
image: cr.44net.ch/ci-plugins/tests
pull: true
commands:
- python3 -m mypy --install-types --non-interactive mangadlp/
- just test_mypy
# mccabe, pycodestyle, pyflakes tests - python
test-pylama:
image: cr.44net.ch/ci-plugins/tests
pull: true
commands:
- python3 -m pylama mangadlp/
# pylint test - python
# ruff test - python
test-pylint:
image: cr.44net.ch/ci-plugins/tests
pull: true
commands:
- python3 -m pip install -r requirements.txt
- python3 -m pylint --fail-under 9 mangadlp/
- just test_ruff
# test mkdocs generation
test-mkdocs:
@ -72,14 +49,14 @@ pipeline:
- cd docs || exit 1
- python3 -m mkdocs build --strict
# test code with different python versions - python
# test code with pytest - python
test-tox-pytest:
when:
event: [ push ]
image: cr.44net.ch/ci-plugins/tests
pull: true
commands:
- python3 -m tox -e basic
- just test_pytest
# generate coverage report - python
test-tox-coverage:
@ -89,7 +66,7 @@ pipeline:
image: cr.44net.ch/ci-plugins/tests
pull: true
commands:
- python3 -m tox -e coverage
- just test_coverage
# analyse code with sonarqube and upload it
sonarqube-analysis:

View file

@ -14,9 +14,6 @@ hatchling>=1.11.0
pytest>=7.0.0
coverage>=6.3.1
black>=22.1.0
isort>=5.10.0
pylint>=2.13.0
mypy>=0.940
tox>=3.24.5
autoflake>=1.4
pylama>=8.3.8
ruff>=0.0.247

View file

@ -68,45 +68,39 @@ create_venv:
@python3 -m venv venv
install_deps:
@echo "installing dependencies"
@pip3 install -r requirements.txt
install_deps_dev:
@echo "installing dependencies"
@pip3 install -r contrib/requirements_dev.txt
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:
@python3 -m black --check --diff .
test_isort:
@python3 -m isort --check-only --diff .
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:
@python3 -m tox -e basic
test_autoflake:
@python3 -m autoflake --remove-all-unused-imports -r -v mangadlp/
@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_coverage:
@python3 -m tox -e coverage
test_tox:
@python3 -m tox
test_tox_coverage:
@python3 -m tox -e coverage
test_build:
@python3 -m hatch build
test_ci_conf:
@woodpecker-cli lint .woodpecker/
@python3 -m hatch build --clean
test_docker_build:
@docker build . -f docker/Dockerfile.amd64 -t manga-dlp:test
@ -123,11 +117,8 @@ lint:
-just test_ci_conf
just test_shfmt
just test_black
just test_isort
just test_mypy
just test_autoflake
just test_pylama
just test_pylint
just test_ruff
@echo -e "\n\033[0;32m=== ALL DONE ===\033[0m\n"
tests:
@ -135,11 +126,8 @@ tests:
-just test_ci_conf
just test_shfmt
just test_black
just test_isort
just test_mypy
just test_autoflake
just test_pylama
just test_pylint
just test_ruff
just test_pytest
@echo -e "\n\033[0;32m=== ALL DONE ===\033[0m\n"
@ -148,13 +136,10 @@ tests_full:
-just test_ci_conf
just test_shfmt
just test_black
just test_isort
just test_mypy
just test_autoflake
just test_pylama
just test_pylint
just test_ruff
just test_build
just test_tox
just test_tox_coverage
just test_coverage
just test_docker_build
@echo -e "\n\033[0;32m=== ALL DONE ===\033[0m\n"

View file

@ -1,5 +1,5 @@
[build-system]
requires = ["hatchling>=1.11.0"]
requires = ["hatchling>=1.11.0"]
build-backend = "hatchling.build"
[project]
@ -9,14 +9,8 @@ description = "A cli manga downloader"
readme = "README.md"
license = "MIT"
requires-python = ">=3.8"
authors = [
{ name = "Ivan Schaller", email = "ivan@schaller.sh" },
]
keywords = [
"manga",
"downloader",
"mangadex",
]
authors = [{ name = "Ivan Schaller", email = "ivan@schaller.sh" }]
keywords = ["manga", "downloader", "mangadex"]
classifiers = [
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
@ -30,17 +24,17 @@ dependencies = [
"loguru>=0.6.0",
"click>=8.1.3",
"click-option-group>=0.5.5",
"xmltodict>=0.13.0"
"xmltodict>=0.13.0",
]
[project.urls]
Homepage = "https://github.com/olofvndrhr/manga-dlp"
History = "https://github.com/olofvndrhr/manga-dlp/commits/master"
Tracker = "https://github.com/olofvndrhr/manga-dlp/issues"
Source = "https://github.com/olofvndrhr/manga-dlp"
History = "https://github.com/olofvndrhr/manga-dlp/commits/master"
Tracker = "https://github.com/olofvndrhr/manga-dlp/issues"
Source = "https://github.com/olofvndrhr/manga-dlp"
[project.scripts]
mangadlp = "mangadlp.cli:main"
mangadlp = "mangadlp.cli:main"
manga-dlp = "mangadlp.cli:main"
[tool.hatch.version]
@ -69,44 +63,89 @@ dependencies = [
"pytest>=7.0.0",
"coverage>=6.3.1",
"black>=22.1.0",
"isort>=5.10.0",
"pylint>=2.13.0",
"mypy>=0.940",
"tox>=3.24.5",
"autoflake>=1.4",
"pylama>=8.3.8",
"ruff>=0.0.247",
]
[tool.isort]
py_version = 39
skip_gitignore = true
line_length = 88
profile = "black"
multi_line_output = 3
include_trailing_comma = true
use_parentheses = true
# mypy
[tool.mypy]
python_version = "3.9"
disallow_untyped_defs = false
follow_imports = "normal"
#strict = true
python_version = "3.9"
disallow_untyped_defs = false
follow_imports = "normal"
ignore_missing_imports = true
warn_no_return = false
warn_unused_ignores = true
show_error_context = true
show_column_numbers = true
show_error_codes = true
pretty = true
no_implicit_optional = false
warn_no_return = false
warn_unused_ignores = true
show_error_context = true
show_column_numbers = true
show_error_codes = true
pretty = true
no_implicit_optional = false
[tool.pytest.ini_options]
pythonpath = [
"."
# ruff
[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]
source = ["mangadlp"]
branch = true
source = ["mangadlp"]
branch = true
command_line = "-m pytest --exitfirst"
[tool.coverage.report]
@ -127,12 +166,3 @@ exclude_lines = [
"@(abc.)?abstractmethod",
]
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"

View file

@ -24,8 +24,3 @@ commands =
coverage erase
coverage run
coverage xml -i
[pylama]
format = pycodestyle
linters = mccabe,pycodestyle,pyflakes
ignore = E501,C901,C0301