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:
Divyansh Singh 2023-03-21 14:35:11 +05:30 committed by real-yfprojects
parent 4d65912d65
commit f0a5a36275
No known key found for this signature in database
GPG Key ID: 00F630DFDEE25747
8 changed files with 18 additions and 21 deletions

View File

@ -13,5 +13,5 @@ trim_trailing_whitespace = true
[Makefile]
indent_style = tab
[.github/**.yml]
[**.{yml,yaml}]
indent_size = 2

View File

@ -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

View File

@ -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

View File

@ -58,8 +58,8 @@ flatpak-install: translations-to-qm
lint:
flake8
isort --check-only .
black --check .
ruff check .
test:
pytest --cov=vorta

View File

@ -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"]

View File

@ -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

View File

@ -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

View File

@ -47,7 +47,7 @@ def main():
want_background = getattr(args, 'daemonize', False)
if want_version:
print(f"Vorta {__version__}")
print(f"Vorta {__version__}") # noqa: T201
sys.exit()
if want_background: