Add ruff and black pre-commit
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
exclude: "docs|.git|.tox"
|
||||
default_stages: [ commit ]
|
||||
fail_fast: true
|
||||
|
||||
repos:
|
||||
|
||||
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
||||
rev: "v0.0.286"
|
||||
hooks:
|
||||
- id: ruff
|
||||
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 23.7.0
|
||||
hooks:
|
||||
- id: black
|
||||
args:
|
||||
- --config=pyproject.toml
|
||||
- src/pydiscourse
|
||||
- tests
|
||||
@@ -3,6 +3,11 @@
|
||||
Release history
|
||||
===============
|
||||
|
||||
1.6.0
|
||||
-----
|
||||
|
||||
- Breaking:
|
||||
|
||||
1.5.0
|
||||
-----
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
[tool.black]
|
||||
line-length=120
|
||||
target-version = ["py311"]
|
||||
|
||||
[tool.ruff]
|
||||
exclude = [
|
||||
".tox",
|
||||
".git",
|
||||
"build",
|
||||
"dist",
|
||||
"docs",
|
||||
".ropeproject",
|
||||
]
|
||||
ignore = [
|
||||
"S101", # Assertions good, actually
|
||||
"TRY003", # For now not worth back tracking
|
||||
]
|
||||
line-length = 240
|
||||
select = [
|
||||
"S", # Security (formerly B when using Bandit directly)
|
||||
"E",
|
||||
"F",
|
||||
"N",
|
||||
"W",
|
||||
"COM", # commas
|
||||
"PT", # pytest
|
||||
"UP", # Upgrade Python syntax
|
||||
"T",
|
||||
"A", # built-in shadowing
|
||||
"FBT", # Boolean traps
|
||||
"BLE", # Blind exceptions
|
||||
"PIE",
|
||||
"TRY",
|
||||
"ERA", # eradicate commented out code
|
||||
]
|
||||
|
||||
[tool.ruff.flake8-pytest-style]
|
||||
fixture-parentheses = false
|
||||
mark-parentheses = true
|
||||
parametrize-names-type = "tuple"
|
||||
parametrize-values-row-type = "tuple"
|
||||
|
||||
[tool.ruff.mccabe]
|
||||
# Unlike Flake8, default to a complexity level of 10.
|
||||
max-complexity = 10
|
||||
|
||||
[tool.coverage.run]
|
||||
include = ["src/pydiscourse/*"]
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
pre-commit==3.3.3
|
||||
pytest==7.4.0
|
||||
pytest-cov==4.1.0
|
||||
pytest-mock==3.11.1 # https://github.com/pytest-dev/pytest-mock/
|
||||
|
||||
Reference in New Issue
Block a user