Browse Source

Changed linting tools to "ruff"

main
Holger Frey 2 years ago
parent
commit
07c5dfd8e7
  1. 25
      .pre-commit-config.yaml
  2. 5
      Makefile
  3. 59
      pyproject.toml

25
.pre-commit-config.yaml

@ -11,33 +11,18 @@ repos:
- id: detect-private-key - id: detect-private-key
- repo: local - repo: local
hooks: hooks:
- id: isort-project
name: isort project
entry: isort -rc src
language: system
pass_filenames: false
- id: isort-test
name: isort test
entry: isort -rc tests
language: system
pass_filenames: false
- id: black - id: black
name: black name: Auto formatting code with "black"
entry: black src tests entry: black src tests
language: system language: system
pass_filenames: false pass_filenames: false
- id: flake8 - id: ruff
name: flake8 project name: Linting code with "ruff"
entry: flake8 src entry: ruff src tests
language: system
pass_filenames: false
- id: flake8
name: flake8 tests
entry: flake8 --ignore S101 tests
language: system language: system
pass_filenames: false pass_filenames: false
- id: pytest - id: pytest
name: pytest name: pytest
entry: pytest tests entry: pytest tests
pass_filenames: false
language: system language: system
pass_filenames: false

5
Makefile

@ -54,11 +54,8 @@ clean-test: ## remove test and coverage artifacts
rm -fr htmlcov/ rm -fr htmlcov/
lint: ## reformat with black and check style with flake8 lint: ## reformat with black and check style with flake8
isort src
isort tests
black src tests black src tests
flake8 src ruff src tests
flake8 --ignore S101 tests
test: lint ## run tests quickly, stop on first error test: lint ## run tests quickly, stop on first error
pytest tests -x -l --last-failed --disable-warnings -m "not functional" pytest tests -x -l --last-failed --disable-warnings -m "not functional"

59
pyproject.toml

@ -46,18 +46,25 @@ test = [
] ]
dev = [ dev = [
"black", "black",
"flake8",
"flake8-comprehensions",
"flake8-bandit",
"isort >= 5.0.0",
"keyring", "keyring",
"pre-commit", "pre-commit",
"ruff",
] ]
docs = [ docs = [
"mkdocs", "mkdocs",
"mkdocstrings[python]", "mkdocstrings[python]",
] ]
[tool.pytest.ini_options]
markers = [
"functional: marks tests as functional (deselect with '-m \"not functional\"')",
]
addopts = [
"--strict-markers",
]
[tool.black] [tool.black]
line-length = 79 line-length = 79
target-version = ['py39', 'py310'] target-version = ['py39', 'py310']
@ -72,16 +79,38 @@ extend-exclude = '''
^/.dist ^/.dist
''' '''
[tool.isort]
line_length=79
multi_line_output=3
length_sort="True"
include_trailing_comma="True"
[tool.pytest.ini_options] [tool.ruff]
markers = [ select = ["ALL"]
"functional: marks tests as functional (deselect with '-m \"not functional\"')", ignore = [
] # ignored for now, should be activated in the future
addopts = [ # docstrings
"--strict-markers", "D",
# flake8-annotations
"ANN",
# flake8-type-checking
"TCH",
# ignored, "black" will handle this
# flake8-commas
"COM",
# ignored, due to Windows / WSL2 setup
# flake8-executable
"EXE",
# project specific ignores
# flake8-import-conventions
"ICN",
] ]
fixable = ["I"]
fix = true
line-length=79
target-version = "py38"
[tool.ruff.per-file-ignores]
# see https://github.com/charliermarsh/ruff
"tests/*" = ["FBT003", "INP001", "PLR2004", "S101"]
[tool.ruff.pydocstyle]
convention = "pep257" # Accepts: "google", "numpy", or "pep257"
Loading…
Cancel
Save