mirror of
https://github.com/borgbase/vorta
synced 2024-12-11 02:28:05 +00:00
ci: Add ruff including print checks
Adds ruff replacing isort. Ruff comes with all flake8 rules and additional rules for print statements. * .github/workflows/test.yml : Replace isort with ruff in comment * .editorconfig : Update `yml` config to apply to all yaml files. * Makefile (lint): Run ruff, remove isort * .pre-commit-config.yaml : Remove isort, run ruff * pyproject.toml : Configure ruff. Remove isort config. * requirements.d/dev.txt : Add ruff, remove isort * setup.cfg : Extend flake8 file ignore * src/vorta/__main__.py : Add *noqa* for print statement.
This commit is contained in:
parent
4d65912d65
commit
f0a5a36275
8 changed files with 18 additions and 21 deletions
|
@ -13,5 +13,5 @@ trim_trailing_whitespace = true
|
|||
[Makefile]
|
||||
indent_style = tab
|
||||
|
||||
[.github/**.yml]
|
||||
[**.{yml,yaml}]
|
||||
indent_size = 2
|
||||
|
|
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
|
@ -24,7 +24,7 @@ jobs:
|
|||
run: |
|
||||
pip install .
|
||||
pip install -r requirements.d/dev.txt
|
||||
- name: Test formatting with Flake8, isort and Black
|
||||
- name: Test formatting with Flake8, ruff and Black
|
||||
run: make lint
|
||||
# - name: Run PyLint (info only)
|
||||
# run: pylint --rcfile=setup.cfg src --exit-zero
|
||||
|
|
|
@ -28,6 +28,12 @@ repos:
|
|||
# sort requirements.txt files
|
||||
- id: requirements-txt-fixer
|
||||
|
||||
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
||||
rev: "v0.0.257"
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: [--fix, --exit-non-zero-on-fix]
|
||||
|
||||
# format python files
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 22.12.0
|
||||
|
@ -35,12 +41,6 @@ repos:
|
|||
- id: black
|
||||
files: ^(src/vorta/|tests)
|
||||
|
||||
# sort python imports
|
||||
- repo: https://github.com/PyCQA/isort
|
||||
rev: 5.12.0
|
||||
hooks:
|
||||
- id: isort
|
||||
|
||||
# # run black on code embedded in docstrings
|
||||
# - repo: https://github.com/asottile/blacken-docs
|
||||
# rev: v1.12.1
|
||||
|
|
2
Makefile
2
Makefile
|
@ -58,8 +58,8 @@ flatpak-install: translations-to-qm
|
|||
|
||||
lint:
|
||||
flake8
|
||||
isort --check-only .
|
||||
black --check .
|
||||
ruff check .
|
||||
|
||||
test:
|
||||
pytest --cov=vorta
|
||||
|
|
|
@ -4,14 +4,11 @@ skip-string-normalization = true
|
|||
target-version = ['py39']
|
||||
include = "(src/vorta/|tests).*.py$"
|
||||
|
||||
[tool.isort]
|
||||
profile = "black"
|
||||
line_length = 120
|
||||
skip_gitignore = true
|
||||
multi_line_output = 3
|
||||
lines_between_sections = 0
|
||||
src_paths = ["src", "tests"]
|
||||
|
||||
[build-system]
|
||||
requires = ["setuptools"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[tool.ruff]
|
||||
select = ["T", "I"]
|
||||
exclude = ["package"]
|
||||
fixable = ["I"]
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
pre-commit
|
||||
black==22.*
|
||||
coverage
|
||||
flake8
|
||||
isort
|
||||
macholib
|
||||
pre-commit
|
||||
pyinstaller
|
||||
pylint
|
||||
pytest
|
||||
|
@ -11,6 +10,7 @@ pytest-cov
|
|||
pytest-faulthandler
|
||||
pytest-mock
|
||||
pytest-qt
|
||||
ruff
|
||||
tox
|
||||
twine
|
||||
wheel
|
||||
|
|
|
@ -77,7 +77,7 @@ max-line-length = 120
|
|||
extend-ignore = E203,E121,E123,E126,E226,E24,E704,W503,W504
|
||||
exclude =
|
||||
build,dist,.git,.idea,.cache,.tox,.eggs,
|
||||
./src/vorta/__init__.py,.direnv
|
||||
./src/vorta/__init__.py,.direnv,env
|
||||
|
||||
[tox:tox]
|
||||
envlist = py36,py37,py38,flake8
|
||||
|
|
|
@ -47,7 +47,7 @@ def exception_handler(type, value, tb):
|
|||
want_background = getattr(args, 'daemonize', False)
|
||||
|
||||
if want_version:
|
||||
print(f"Vorta {__version__}")
|
||||
print(f"Vorta {__version__}") # noqa: T201
|
||||
sys.exit()
|
||||
|
||||
if want_background:
|
||||
|
|
Loading…
Reference in a new issue