# Pre-commit hooks configuration for GaitSetPy
# See https://pre-commit.com for more information
# To install: pip install pre-commit && pre-commit install

repos:
  # General file checks
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.5.0
    hooks:
      - id: trailing-whitespace
      - id: end-of-file-fixer
      - id: check-yaml
      - id: check-json
      - id: check-added-large-files
        args: ['--maxkb=1000']
      - id: check-case-conflict
      - id: check-merge-conflict
      - id: detect-private-key
      - id: mixed-line-ending
        args: ['--fix=lf']

  # Python code formatting with Black
  - repo: https://github.com/psf/black
    rev: 24.3.0
    hooks:
      - id: black
        language_version: python3
        args: ['--line-length=100']

  # Import sorting with isort
  - repo: https://github.com/pycqa/isort
    rev: 5.13.2
    hooks:
      - id: isort
        args: ['--profile=black', '--line-length=100']

  # Flake8 for linting
  - repo: https://github.com/pycqa/flake8
    rev: 7.0.0
    hooks:
      - id: flake8
        args: [
          '--max-line-length=100',
          '--extend-ignore=E203,E501,W503',
          '--exclude=.git,__pycache__,build,dist,*.egg-info,.venv,venv'
        ]

  # Type checking with mypy (optional but recommended)
  - repo: https://github.com/pre-commit/mirrors-mypy
    rev: v1.9.0
    hooks:
      - id: mypy
        args: ['--ignore-missing-imports', '--no-strict-optional']
        additional_dependencies: ['types-requests']

  # Security checks with bandit
  - repo: https://github.com/PyCQA/bandit
    rev: 1.7.8
    hooks:
      - id: bandit
        args: ['-c', 'pyproject.toml']
        additional_dependencies: ['bandit[toml]']

  # Docstring formatting with docformatter (optional)
  - repo: https://github.com/PyCQA/docformatter
    rev: v1.7.5
    hooks:
      - id: docformatter
        args: ['--in-place', '--wrap-summaries=100', '--wrap-descriptions=100']

# Exclude certain files from checks
exclude: |
  (?x)^(
      .*\.html|
      .*\.js|
      .*\.md|
      .*\.txt|
      docs/.*|
      .github/.*
  )$

# CI configuration
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
