# Modern Python pre-commit configuration (2025)
# Install: pre-commit install
# Run manually: pre-commit run --all-files

repos:
  # Ruff - Ultra-fast Python linter & formatter (replaces black, isort, flake8, etc.)
  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.8.4
    hooks:
      # Run the linter
      - id: ruff
        args: [--fix]
      # Run the formatter
      - id: ruff-format

  # Security scanning with bandit
  - repo: https://github.com/PyCQA/bandit
    rev: '1.7.10'
    hooks:
      - id: bandit
        args: ['-c', 'pyproject.toml', '--skip', 'B108,B301,B403']
        additional_dependencies: ["bandit[toml]"]

  # Check for secrets/credentials
  - repo: https://github.com/Yelp/detect-secrets
    rev: v1.5.0
    hooks:
      - id: detect-secrets
        args: ['--baseline', '.secrets.baseline']


  # Standard pre-commit hooks
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v5.0.0
    hooks:
      - id: trailing-whitespace
      - id: end-of-file-fixer
      - id: check-yaml
      - id: check-added-large-files
        args: [--maxkb=1000]
      - id: check-json
      - id: check-toml
      - id: check-merge-conflict
      - id: debug-statements
      - id: mixed-line-ending

  # Architecture validation
  - repo: local
    hooks:
      - id: validate-architecture
        name: Validate Architecture Model
        entry: uv run python tools/validate_architecture.py --quick
        language: system
        pass_filenames: false
        files: ^(docs/architecture/model\.yaml|ondine/.*)$


ci:
  autofix_commit_msg: |
    [pre-commit.ci] auto fixes from pre-commit hooks
  autofix_prs: true
  autoupdate_branch: ''
  autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
  autoupdate_schedule: weekly
  skip: []
  submodules: false
