目录

pre-commit

install

Bash
  1. uv add pre-commit
Bash
  1. uv run pre-commit install

conf

Bash
  1. touch .pre-commit-config.yaml
yaml
  1. # See https://pre-commit.com for more information
  2. # See https://pre-commit.com/hooks.html for more hooks
  3. repos:
  4. - repo: https://github.com/pre-commit/pre-commit-hooks
  5. rev: v3.2.0
  6. hooks:
  7. - id: trailing-whitespace
  8. - id: end-of-file-fixer
  9. - id: check-yaml
  10. - id: check-added-large-files
  11. - repo: https://github.com/astral-sh/ruff-pre-commit
  12. # Ruff version.
  13. rev: v0.12.9
  14. hooks:
  15. # Run the linter.
  16. - id: ruff-check
  17. args: [ --fix ]
  18. # Run the formatter.
  19. - id: ruff-format