mirror of
https://github.com/ocrmypdf/OCRmyPDF.git
synced 2026-07-30 06:57:28 -04:00
Fix the 13 errors that surfaced under mypy --check-untyped-defs so the flag can be turned on permanently in pyproject.toml, and drop the advisory exit-0 wrapper on the mypy pre-commit hook now that the tree is clean. - _plugin_manager: rename colliding loop vars (module/name were reused with conflicting types) and guard spec/spec.loader from spec_from_file_location; call __init__ via the class in __setstate__. - __main__: pass Verbosity(options.verbose), not a bare int. - subprocess/_check: widen package to str | Mapping[str, str] to match _error_trailer's existing per-platform handling. - optimize.main: annotate the standalone PdfContext(..., None, None) that only ever reads context.options.
65 lines
1.5 KiB
TOML
65 lines
1.5 KiB
TOML
# prek pre-commit configuration — https://prek.j178.dev
|
|
#
|
|
# The local/system hooks below invoke the project's OWN pinned tools (ruff/mypy
|
|
# from uv.lock) and mirror .github/workflows/build.yml's lint job exactly, so
|
|
# they can never drift from CI's versions or rules. prek installs nothing of
|
|
# its own for them — "system" language just execs whatever `uv run` resolves.
|
|
#
|
|
# The pre-commit/pre-commit-hooks repo hooks below are generic file checks with
|
|
# no project-local tool equivalent, so they're kept as a normal (non-local) repo.
|
|
#
|
|
# Run all checks manually: `uv run prek run --all-files`
|
|
# Install the git hooks: `uv run prek install`
|
|
|
|
default_install_hook_types = ["pre-commit", "pre-push"]
|
|
default_stages = ["pre-commit"]
|
|
|
|
[[repos]]
|
|
repo = "https://github.com/pre-commit/pre-commit-hooks"
|
|
rev = "v4.4.0"
|
|
|
|
[[repos.hooks]]
|
|
id = "check-case-conflict"
|
|
|
|
[[repos.hooks]]
|
|
id = "check-merge-conflict"
|
|
|
|
[[repos.hooks]]
|
|
id = "check-toml"
|
|
|
|
[[repos.hooks]]
|
|
id = "check-yaml"
|
|
|
|
[[repos.hooks]]
|
|
id = "debug-statements"
|
|
|
|
[[repos]]
|
|
repo = "local"
|
|
|
|
[[repos.hooks]]
|
|
id = "ruff-format"
|
|
name = "ruff format (check)"
|
|
language = "system"
|
|
entry = "uv run ruff format --check ."
|
|
types = ["python"]
|
|
pass_filenames = false
|
|
require_serial = true
|
|
|
|
[[repos.hooks]]
|
|
id = "ruff-check"
|
|
name = "ruff check"
|
|
language = "system"
|
|
entry = "uv run ruff check ."
|
|
types = ["python"]
|
|
pass_filenames = false
|
|
require_serial = true
|
|
|
|
[[repos.hooks]]
|
|
id = "mypy"
|
|
name = "mypy"
|
|
language = "system"
|
|
entry = "uv run mypy src/ocrmypdf"
|
|
types = ["python"]
|
|
pass_filenames = false
|
|
require_serial = true
|