Skip to content

Commit

Permalink
pre-commit hook maintenance (#44)
Browse files Browse the repository at this point in the history
* use the `black` mirror

* replace `isort` and `flake8` with `ruff`

* use a working mirror of `prettier`

* use `taplo`

* remove the redundant `yaml` check
  • Loading branch information
keewis authored Dec 9, 2024
1 parent cc3bddf commit c1e6076
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 29 deletions.
13 changes: 0 additions & 13 deletions .flake8

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/.hypothesis/
__pycache__/

/.prettier_cache/
26 changes: 15 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,28 @@ repos:
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml

- repo: https://github.com/psf/black
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.10.0
hooks:
- id: black

- repo: https://github.com/pycqa/isort
rev: 5.13.2
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.2
hooks:
- id: isort
- id: ruff
args: ["--fix", "--show-fixes"]

- repo: https://github.com/pycqa/flake8
rev: 7.1.1
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.4.2
hooks:
- id: flake8
- id: prettier
args: ["--cache-location=.prettier_cache/cache"]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
- repo: https://github.com/ComPWA/taplo-pre-commit
rev: v0.9.3
hooks:
- id: prettier
- id: taplo-format
args: ["--option", "array_auto_collapse=false"]
- id: taplo-lint
args: ["--no-schema"]
49 changes: 44 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
[tool.isort]
profile = "black"
skip_gitignore = true
float_to_top = true
default_section = "THIRDPARTY"
[tool.ruff]
target-version = "py310"
builtins = ["ellipsis"]
exclude = [
".git",
".eggs",
"build",
"dist",
"__pycache__",
]
line-length = 100

[tool.ruff.lint]
# E402: module level import not at top of file
# E501: line too long - let black worry about that
# E731: do not assign a lambda expression, use a def
ignore = [
"E402",
"E501",
"E731",
]
select = [
"F", # Pyflakes
"E", # Pycodestyle
"I", # isort
"UP", # Pyupgrade
"TID", # flake8-tidy-imports
"W",
]
extend-safe-fixes = [
"TID252", # absolute imports
]
fixable = ["I", "TID252"]

[tool.ruff.lint.flake8-tidy-imports]
# Disallow all relative imports.
ban-relative-imports = "all"

[tool.coverage.run]
branch = true

[tool.coverage.report]
show_missing = true
exclude_lines = ["pragma: no cover", "if TYPE_CHECKING"]

0 comments on commit c1e6076

Please sign in to comment.