# Pre-commit hooks for tablesleuth
# Install: uv run pre-commit install
# Run manually: uv run pre-commit run --all-files

repos:
  # Ruff - replaces black, isort, flake8
  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.15.2
    hooks:
      # Run the linter
      - id: ruff
        args: [--fix]
      # Run the formatter
      - id: ruff-format

  # mypy - type checking
  - repo: https://github.com/pre-commit/mirrors-mypy
    rev: v1.19.1
    hooks:
      - id: mypy
        additional_dependencies:
          - types-toml
          - types-pyyaml
          - pydantic>=2.0
          - textual>=0.47.0
          - rich>=13.0.0
          - pyarrow>=14.0.0
          - pyiceberg>=0.6.0
          - adbc-driver-flightsql>=0.8.0
          - boto3>=1.34.0
          - botocore>=1.34.0
          - fsspec>=2023.0.0
          - s3fs>=2023.0.0
          - fastavro>=1.9.0
        args: [--config-file=pyproject.toml, src/]
        pass_filenames: false

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

  # Security scanning with bandit
  - repo: https://github.com/PyCQA/bandit
    rev: 1.9.3
    hooks:
      - id: bandit
        args: [-c, pyproject.toml, -r, src/]
        additional_dependencies: ["bandit[toml]"]
