目录

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. default_install_hook_types:
  2. - pre-commit
  3. - commit-msg
  4.  
  5. repos:
  6. - repo: https://github.com/pre-commit/pre-commit-hooks
  7. rev: v6.0.0
  8. hooks:
  9. - id: trailing-whitespace
  10. - id: end-of-file-fixer
  11. - id: check-yaml
  12. - id: check-added-large-files
  13. - repo: https://github.com/astral-sh/ruff-pre-commit
  14. # Ruff version.
  15. rev: v0.13.2
  16. hooks:
  17. - id: ruff-check
  18. args: [--fix]
  19. - id: ruff-format
  20. - repo: https://github.com/compilerla/conventional-pre-commit
  21. rev: v4.2.0
  22. hooks:
  23. - id: conventional-pre-commit
  24. stages: [commit-msg]
  25. args: []