فحص قبل الالتزام بـ pre-commit

pre-commit Hooks

وصفة أتمتةمتوسط

فحوص تلقائية قبل كل التزام: التنسيق، والملفات الكبيرة، والمفاتيح الخاصة.

الخطوات

  1. ثبّت الأداة: pip install pre-commit.

  2. أنشئ .pre-commit-config.yaml.

  3. فعّلها: pre-commit install.

  4. شغّلها على كل الملفات: pre-commit run --all-files.

مثال · yaml
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v6.0.0
    hooks:
      - id: check-added-large-files
      - id: detect-private-key
      - id: end-of-file-fixer
      - id: trailing-whitespace

المصادر

  1. pre-commit framework