Skip to content

Commit

Permalink
build(lint): Use ruff over black
Browse files Browse the repository at this point in the history
  • Loading branch information
asyrjasalo committed Jul 29, 2024
1 parent 91bc00c commit 20b9a9e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 109 deletions.
7 changes: 4 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ repos:
- id: destroyed-symlinks
- id: check-executables-have-shebangs

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.4.2
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.5
hooks:
- id: black
- id: ruff
- id: ruff-format

- repo: https://github.com/commitizen-tools/commitizen
rev: v3.28.0
Expand Down
91 changes: 5 additions & 86 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 18 additions & 20 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ distribution = true

[tool.pdm.dev-dependencies]
dev = [
"black",
"ruff"
]
test = [
Expand All @@ -63,28 +62,11 @@ test = "python -m pytest test/"
testenv = "npx -y mountebank --host localhost --allowInjection --configfile testapi/apis.ejs"
atest = "python -m robot -P src --xunit xunit.xml --outputdir results atest/"
tests = { composite = ["test", "atest"] }
format = "black ."
format = "ruff format ."
lint = "ruff check ."
docs = "python -m robot.libdoc -P src REST docs/index.html"
clear = { shell = "rm -rf dist/ node_modules/ .pdm-build/ .pytest_cache/ results/ src/*.egg-info mb.pid *.log" }

[tool.black]
line-length = 80
exclude = '''
/(
| \.git
| \.mypy_cache
| \.pytest_cache
| \.venv
| atest
| dist
| docs
| node_modules
| results
| testapi
)/
'''

[tool.pytest]
testpaths = "test"
addopts = "--cov --spec --instafail --diff-type=auto"
Expand All @@ -93,5 +75,21 @@ addopts = "--cov --spec --instafail --diff-type=auto"
disallow_untyped_defs = true
ignore_missing_imports = true

[tool.ruff]
line-length = 80
indent-width = 4
exclude = [
".git",
".mypy_cache",
".pytest_cache",
".venv",
"atest",
"dist",
"docs",
"node_modules",
"results",
"testapi"
]

[tool.ruff.lint]
select = ["E4", "E7", "E9", "F", "I", "Q"]
select = ["E4", "E7", "E9", "F", "I", "Q", "W"]

0 comments on commit 20b9a9e

Please sign in to comment.