mirror of https://github.com/borgbackup/borg.git
replace flake8 by ruff
This commit is contained in:
parent
1fd8b52f6b
commit
98796a2f0d
|
@ -32,18 +32,11 @@ jobs:
|
||||||
lint:
|
lint:
|
||||||
|
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
timeout-minutes: 10
|
timeout-minutes: 2
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Set up Python
|
- uses: chartboost/ruff-action@v1
|
||||||
uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: 3.9
|
|
||||||
- name: Lint with flake8
|
|
||||||
run: |
|
|
||||||
pip install flake8
|
|
||||||
flake8 src scripts conftest.py
|
|
||||||
|
|
||||||
linux:
|
linux:
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,7 @@ repos:
|
||||||
rev: 23.1.0
|
rev: 23.1.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
- repo: https://github.com/pycqa/flake8
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: 6.0.0
|
rev: v0.0.287
|
||||||
hooks:
|
hooks:
|
||||||
- id: flake8
|
- id: ruff
|
||||||
files: '(src|scripts|conftest.py)'
|
|
||||||
|
|
|
@ -12,7 +12,8 @@
|
||||||
# If extensions (or modules to document with autodoc) are in another directory,
|
# If extensions (or modules to document with autodoc) are in another directory,
|
||||||
# add these directories to sys.path here. If the directory is relative to the
|
# add these directories to sys.path here. If the directory is relative to the
|
||||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||||
import sys, os
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
sys.path.insert(0, os.path.abspath("../src"))
|
sys.path.insert(0, os.path.abspath("../src"))
|
||||||
|
|
||||||
|
|
|
@ -12,3 +12,58 @@ write_to_template = "__version__ = version = {version!r}\n"
|
||||||
[tool.black]
|
[tool.black]
|
||||||
line-length = 120
|
line-length = 120
|
||||||
skip-magic-trailing-comma = true
|
skip-magic-trailing-comma = true
|
||||||
|
|
||||||
|
[tool.ruff]
|
||||||
|
line-length = 120
|
||||||
|
target-version = "py39"
|
||||||
|
|
||||||
|
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
|
||||||
|
select = ["E", "F"]
|
||||||
|
|
||||||
|
# for reference ...
|
||||||
|
# E402 module level import not at top
|
||||||
|
# E501 line too long
|
||||||
|
# F401 import unused
|
||||||
|
# F405 undefined or defined from star imports
|
||||||
|
# F811 redef of unused var
|
||||||
|
|
||||||
|
# borg code style guidelines:
|
||||||
|
# Ignoring E203 due to https://github.com/PyCQA/pycodestyle/issues/373
|
||||||
|
ignore = ["E203", "F405", "E402"]
|
||||||
|
|
||||||
|
# Allow autofix for all enabled rules (when `--fix`) is provided.
|
||||||
|
fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
|
||||||
|
unfixable = []
|
||||||
|
|
||||||
|
# Exclude a variety of commonly ignored directories.
|
||||||
|
exclude = [
|
||||||
|
".cache",
|
||||||
|
".eggs",
|
||||||
|
".git",
|
||||||
|
".git-rewrite",
|
||||||
|
".idea",
|
||||||
|
".mypy_cache",
|
||||||
|
".ruff_cache",
|
||||||
|
".tox",
|
||||||
|
"build",
|
||||||
|
"dist",
|
||||||
|
]
|
||||||
|
|
||||||
|
# Allow unused variables when underscore-prefixed.
|
||||||
|
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
||||||
|
|
||||||
|
# Code style violation exceptions:
|
||||||
|
# please note that the values are adjusted so that they do not cause failures
|
||||||
|
# with existing code. if you want to change them, you should first fix all
|
||||||
|
# ruff failures that appear with your change.
|
||||||
|
[tool.ruff.per-file-ignores]
|
||||||
|
"setup_docs.py" = ["E501"]
|
||||||
|
"src/borg/archive.py" = ["E501"]
|
||||||
|
"src/borg/archiver/help_cmd.py" = ["E501"]
|
||||||
|
"src/borg/cache.py" = ["E501"]
|
||||||
|
"src/borg/helpers/__init__.py" = ["F401"]
|
||||||
|
"src/borg/platform/__init__.py" = ["F401"]
|
||||||
|
"src/borg/testsuite/archiver/disk_full.py" = ["F811"]
|
||||||
|
"src/borg/testsuite/archiver/return_codes.py" = ["F811"]
|
||||||
|
"src/borg/testsuite/benchmark.py" = ["F811"]
|
||||||
|
"src/borg/testsuite/platform.py" = ["F811"]
|
||||||
|
|
33
setup.cfg
33
setup.cfg
|
@ -74,39 +74,6 @@ python_files = testsuite/*.py
|
||||||
markers =
|
markers =
|
||||||
allow_cache_wipe
|
allow_cache_wipe
|
||||||
|
|
||||||
[flake8]
|
|
||||||
# for reference ...
|
|
||||||
# E402 module level import not at top
|
|
||||||
# E501 line too long
|
|
||||||
# F401 import unused
|
|
||||||
# F405 undefined or defined from star imports
|
|
||||||
# F811 redef of unused var
|
|
||||||
# #### Pick either W503, or W504 - latest recommendation from pep8 is to ignore W503
|
|
||||||
# W503 line break before binary operator
|
|
||||||
# W504 line break after binary operator
|
|
||||||
|
|
||||||
# borg code style guidelines:
|
|
||||||
# Ignoring E203 due to https://github.com/PyCQA/pycodestyle/issues/373
|
|
||||||
ignore = W503, E203, F405, E402
|
|
||||||
|
|
||||||
# Code style violation exceptions:
|
|
||||||
# please note that the values are adjusted so that they do not cause failures
|
|
||||||
# with existing code. if you want to change them, you should first fix all
|
|
||||||
# flake8 failures that appear with your change.
|
|
||||||
per_file_ignores =
|
|
||||||
src/borg/archive.py:E501
|
|
||||||
src/borg/archiver/help_cmd.py:E501
|
|
||||||
src/borg/cache.py:E501
|
|
||||||
src/borg/helpers/__init__.py:F401
|
|
||||||
src/borg/platform/__init__.py:F401
|
|
||||||
src/borg/testsuite/archiver/disk_full.py:F811
|
|
||||||
src/borg/testsuite/archiver/return_codes.py:F811
|
|
||||||
src/borg/testsuite/benchmark.py:F811
|
|
||||||
src/borg/testsuite/platform.py:F811
|
|
||||||
|
|
||||||
max_line_length = 120
|
|
||||||
exclude = build,dist,.git,.idea,.cache,.tox
|
|
||||||
|
|
||||||
[mypy]
|
[mypy]
|
||||||
python_version = 3.9
|
python_version = 3.9
|
||||||
strict_optional = False
|
strict_optional = False
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import FrozenSet, Set, NamedTuple, Tuple, Mapping, Dict, List, Iterator, Callable, Any, Optional
|
from typing import Set, NamedTuple, Tuple, Mapping, Dict, List, Iterator, Callable, Any, Optional
|
||||||
|
|
||||||
from .helpers import StableDict
|
from .helpers import StableDict
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ class ArchiveItem(PropDict):
|
||||||
def items(self, val: List) -> None: ...
|
def items(self, val: List) -> None: ...
|
||||||
@property
|
@property
|
||||||
def item_ptrs(self) -> List: ...
|
def item_ptrs(self) -> List: ...
|
||||||
@items.setter
|
@item_ptrs.setter
|
||||||
def item_ptrs(self, val: List) -> None: ...
|
def item_ptrs(self, val: List) -> None: ...
|
||||||
|
|
||||||
class ChunkListEntry(NamedTuple):
|
class ChunkListEntry(NamedTuple):
|
||||||
|
|
6
tox.ini
6
tox.ini
|
@ -28,13 +28,13 @@ passenv = *
|
||||||
passenv = * # needed by tox4, so env vars are visible for building borg
|
passenv = * # needed by tox4, so env vars are visible for building borg
|
||||||
|
|
||||||
|
|
||||||
[testenv:flake8]
|
[testenv:ruff]
|
||||||
skip_sdist=true
|
skip_sdist=true
|
||||||
skip_install=true
|
skip_install=true
|
||||||
changedir =
|
changedir =
|
||||||
deps =
|
deps =
|
||||||
flake8
|
ruff
|
||||||
commands = flake8 src scripts conftest.py
|
commands = ruff check .
|
||||||
|
|
||||||
[testenv:mypy]
|
[testenv:mypy]
|
||||||
changedir =
|
changedir =
|
||||||
|
|
Loading…
Reference in New Issue