repos:

  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.5.0
    hooks:
      - id: end-of-file-fixer
        exclude: ^docs/
      - id: trailing-whitespace
        exclude: ^docs/
      - id: check-json
        exclude: ^docs/
      - id: pretty-format-json
        exclude: ^docs/
        args:
        - --autofix
        - --no-sort-keys


  - repo: https://github.com/PyCQA/autoflake
    rev: v2.0.1
    hooks:
      - id: autoflake
        args: [--in-place,--remove-all-unused-imports,--remove-unused-variables,--ignore-init-module-imports]

  - repo: https://github.com/PyCQA/isort
    rev: 5.12.0
    hooks:
      - id: isort
        language_version: python3.9
        args: [--multi-line=3,--trailing-comma,--force-grid-wrap=0,--use-parentheses,--line-length=88,--ensure-newline-before-comments]

  - repo: https://github.com/ambv/black
    rev: 25.1.0
    hooks:
      - id: black
        language_version: python3.9
        args: [--fast]

  - repo: local
    hooks:
      - id: pdoc-generate
        name: Generate pdoc documentation
        description: Regenerates HTML docs in docs/ and stages changes
        language: python  # pre‑commit creates a venv & installs deps below
        entry: bash -c 'pdoc lightudq --output-dir docs && git add docs'
        # Run only when Python source files change:
        files: ^(src/|lightudq/|README\.md$)  # tweak to match your layout
        pass_filenames: false        # we don’t need individual file args
        require_serial: true         # avoid parallel race conditions
