exclude: 'node_modules|.git'
default_stages: [pre-commit]
fail_fast: false

repos:
  - repo: http://git.jingrow.com/pre-commit/mirrors-prettier
    rev: v4.0.0-alpha.8
    hooks:
      - id: prettier
        types_or: [javascript, vue]
        # Ignore any files that might contain jinja / bundles
        exclude: |
          (?x)^(
              jcloude/public/dist/.*|
              .*node_modules.*|
              .*boilerplate.*|
              jcloude/www/website_script.js|
              jcloude/templates/includes/.*|
              jcloude/public/js/.*min.js
          )$

  - repo: http://git.jingrow.com/pre-commit/pre-commit-hooks
    rev: v6.0.0
    hooks:
      - id: debug-statements
      - id: trailing-whitespace
        files: 'jcloude.*'
        exclude: '.*json$|.*txt$|.*csv|.*md|.*svg'
      - id: check-merge-conflict
      - id: check-ast
      - id: check-json
      - id: check-toml
      - id: check-yaml

  - repo: http://git.jingrow.com/astral-sh/ruff-pre-commit
    rev: v0.13.1
    hooks:
      - id: ruff
        args: [--fix]
      - id: ruff-format

  - repo: local
    hooks:
      - id: commitlint
        name: check commit message format
        entry: npx commitlint --edit .git/COMMIT_EDITMSG
        language: system
        stages: [commit-msg]
        always_run: true

      - id: cspell-commit-msg
        name: check commit message spelling
        entry: npx cspell --config .cspell.json .git/COMMIT_EDITMSG
        language: system
        stages: [commit-msg]
        always_run: true

      - id: cspell-modified-files
        name: check spelling of files
        entry: sh -c "npx cspell --no-must-find-files --config .cspell.json `git diff --cached -p --name-status | cut -c3- | tr '\n' ' '`"
        language: system
        stages: [pre-commit]

      - id: todo-warning
        name: check todos
        entry: .github/hooks/todo-warning.sh
        language: script
        stages: [pre-commit]
        verbose: true

  - repo: http://git.jingrow.com/pre-commit/mirrors-mypy
    rev: v1.18.2
    hooks:
      - id: mypy
        args:
          [
            --ignore-missing-imports,
            --follow-imports=skip,
            --exclude-gitignore,
            --no-warn-no-return,
            --disable-error-code=annotation-unchecked,
          ]
        exclude: ^tests/|test_.*\.py$ # Exclude the 'tests/' directory and files starting with 'test_'
        additional_dependencies:
          [
            types-requests<2.32,
            types-pytz~=2025.2,
            types-python-dateutil~=2.9.0,
          ]
