Skip to content

Commit

Permalink
refactor: fix styling and typing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
eifinger committed Jan 20, 2024
1 parent c16c38e commit 6174ada
Show file tree
Hide file tree
Showing 5 changed files with 22,826 additions and 114 deletions.
41 changes: 17 additions & 24 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
---
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.7
hooks:
- id: ruff-format
name: ☕️ Format using ruff
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.7
hooks:
- id: ruff
name: ✅ Lint using ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.0-alpha.6"
hooks:
- id: prettier
name: 💄 Ensuring files are prettier
types: [yaml, json, markdown]
- repo: local
hooks:
- id: black
name: ☕️ Format using black
language: system
types: [python]
entry: rye run black
require_serial: true
- id: blacken-docs
name: ☕️ Format documentation examples using black
language: system
files: '\.(rst|md|markdown|py|tex)$'
entry: rye run blacken-docs
require_serial: true
- id: check-ast
name: 🐍 Check Python AST
language: system
Expand Down Expand Up @@ -118,18 +123,6 @@ repos:
language: system
types: [yaml]
entry: rye run yamllint
- id: ruff
name: ⚡️ Check with ruff
language: system
entry: rye run ruff check
types: [python]
args: ["--force-exclude"]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.0-alpha.6"
hooks:
- id: prettier
name: 💄 Ensuring files are prettier
types: [yaml, json, markdown]
- repo: https://github.com/koalaman/shellcheck-precommit
rev: "v0.9.0"
hooks:
Expand Down
65 changes: 53 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,62 @@ build-backend = "hatchling.build"
[tool.rye]
managed = true
dev-dependencies = [
"pytest>=7.4.0",
"black>=23.7.0",
"blacken-docs>=1.14.0",
"codespell>=2.2.5",
"mypy>=1.4.1",
"pre-commit>=3.3.3",
"vulture>=2.7",
"yamllint>=1.32.0",
"ruff>=0.0.281",
"pre-commit-hooks>=4.4.0",
"respx>=0.20.1",
"pytest>=7.4.4",
"codespell>=2.2.6",
"mypy>=1.8.0",
"pre-commit>=3.5.0",
"yamllint>=1.33.0",
"ruff>=0.1.13",
"pre-commit-hooks>=4.5.0",
"respx>=0.20.2",
"pytest-cov>=4.1.0",
"pytest-asyncio>=0.21.1",
"pytest-asyncio>=0.23.3",
]

[tool.ruff]
target-version = "py311"
line-length = 120

[tool.ruff.lint]
ignore = [
"D107", # Missing docstring in __init__
"D202", # No blank lines allowed after function docstring
"D203", # 1 blank line required before class docstring
"D213", # Multi-line docstring summary should start at the second line
"D404", # First word of the docstring should not be This
"D406", # Section name should end with a newline
"D407", # Section name underlining
"D411", # Missing blank line before section
"E501", # line too long
"E731", # do not assign a lambda expression, use a def
]
select = [
"B007", # Loop control variable {name} not used within loop body
"B014", # Exception handler with duplicate exception
"C", # complexity
"D", # docstrings
"E", # pycodestyle
"F", # pyflakes/autoflake
"ICN001", # import concentions; {name} should be imported as {asname}
"PGH004", # Use specific rule codes when using noqa
"PLC0414", # Useless import alias. Import alias does not rename original package.
"SIM105", # Use contextlib.suppress({exception}) instead of try-except-pass
"SIM117", # Merge with-statements that use the same scope
"SIM118", # Use {key} in {dict} instead of {key} in {dict}.keys()
"SIM201", # Use {left} != {right} instead of not {left} == {right}
"SIM212", # Use {a} if {a} else {b} instead of {b} if not {a} else {a}
"SIM300", # Yoda conditions. Use 'age == 42' instead of '42 == age'.
"SIM401", # Use get from dict with default instead of an if block
"T20", # flake8-print
"TRY004", # Prefer TypeError exception for invalid type
"RUF006", # Store a reference to the return value of asyncio.create_task
"UP", # pyupgrade
"W", # pycodestyle
]

[tool.ruff.mccabe]
max-complexity = 12

[tool.hatch.metadata]
allow-direct-references = true

Expand Down
21 changes: 8 additions & 13 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@

-e file:.
anyio==3.7.1
black==23.7.0
blacken-docs==1.15.0
certifi==2023.7.22
cfgv==3.3.1
click==8.1.6
codespell==2.2.5
codespell==2.2.6
coverage==7.2.7
distlib==0.3.7
filelock==3.12.2
Expand All @@ -23,28 +20,26 @@ httpx==0.24.1
identify==2.5.26
idna==3.4
iniconfig==2.0.0
mypy==1.4.1
mypy==1.8.0
mypy-extensions==1.0.0
nodeenv==1.8.0
packaging==23.1
pathspec==0.11.2
platformdirs==3.10.0
pluggy==1.2.0
pre-commit==3.3.3
pre-commit-hooks==4.4.0
pytest==7.4.0
pytest-asyncio==0.21.1
pre-commit==3.6.0
pre-commit-hooks==4.5.0
pytest==7.4.4
pytest-asyncio==0.23.3
pytest-cov==4.1.0
pyyaml==6.0.1
respx==0.20.2
ruamel-yaml==0.17.32
ruamel-yaml-clib==0.2.7
ruff==0.0.282
ruff==0.1.13
sniffio==1.3.0
toml==0.10.2
typing-extensions==4.7.1
virtualenv==20.24.2
vulture==2.7
yamllint==1.32.0
yamllint==1.33.0
# The following packages are considered to be unsafe in a requirements file:
setuptools==68.0.0
Loading

0 comments on commit 6174ada

Please sign in to comment.