repos:
  - repo: https://github.com/astral-sh/ruff-pre-commit
    # Ruff version.
    rev: v0.3.7
    hooks:
      # Run the linter.
      - id: ruff
        args: [--fix]
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.1.0
    hooks:
      - id: check-ast
      - id: check-docstring-first
      - id: check-executables-have-shebangs
      - id: check-merge-conflict
      - id: check-symlinks
      - id: debug-statements
      - id: trailing-whitespace
      - id: check-yaml
        args: [--allow-multiple-documents]
      - id: mixed-line-ending
      - id: name-tests-test
        args: ['--django']
      - id: check-json
      - id: requirements-txt-fixer
      - id: end-of-file-fixer
      - id: mixed-line-ending
  - repo: https://github.com/codespell-project/codespell
    rev: v2.1.0
    hooks:
      - id: codespell
        args: ['--write-changes']
        exclude: '^arkindex\/(documents\/export|sql_validation)\/.*\.sql'
  - repo: meta
    hooks:
      - id: check-useless-excludes
  - repo: https://gitlab.teklia.com/tools/pre-commit-hooks
    rev: 0.1.0
    hooks:
      - id: long-test-files
        args: ['1000']
        # Only run on Arkindex unit test files
        files: '^arkindex\/[^\/]*\/tests\/(.*\/)?test_.*\.py'

  - repo: local
    hooks:
      - id: check-system-workers-version
        name: Check system workers version matches current Arkindex version
        entry: python ci/check_system_workers.py
        language: system
        pass_filenames: false
        files: '^(VERSION|arkindex/system_workers.yml)$'
