---
ci:
  # format compatible with commitlint
  autoupdate_commit_msg: "chore: pre-commit autoupdate"
  autoupdate_schedule: monthly
  autofix_commit_msg: |
    chore: auto fixes from pre-commit.com hooks

    for more information, see https://pre-commit.ci
  skip:
    # https://github.com/pre-commit-ci/issues/issues/55
    - pip-compile
    - pip-compile-docs
default_language_version:
  # Needed in order to make pip-compile output predictable.
  python: python3.9
repos:
  - repo: https://github.com/pre-commit/mirrors-prettier
    # keep it before yamllint
    rev: "v2.6.2"
    hooks:
      - id: prettier
        additional_dependencies:
          - prettier
          - prettier-plugin-toml
  - repo: https://github.com/pre-commit/pre-commit-hooks.git
    rev: v4.2.0
    hooks:
      - id: end-of-file-fixer
      - id: trailing-whitespace
        exclude: >
          (?x)^(
            examples/playbooks/(with-skip-tag-id|unicode).yml|
            examples/playbooks/example.yml
          )$
      - id: mixed-line-ending
      - id: check-byte-order-marker
      - id: check-executables-have-shebangs
      - id: check-merge-conflict
      - id: debug-statements
        language_version: python3
  - repo: https://github.com/codespell-project/codespell
    rev: v2.1.0
    hooks:
      - id: codespell
  - repo: https://github.com/PyCQA/doc8
    rev: 0.11.1
    hooks:
      - id: doc8
  - repo: https://github.com/adrienverge/yamllint.git
    rev: v1.26.3
    hooks:
      - id: yamllint
        files: \.(yaml|yml)$
        types: [file, yaml]
        entry: yamllint --strict
  - repo: https://github.com/PyCQA/isort
    rev: 5.10.1
    hooks:
      - id: isort
        args:
          # https://github.com/pre-commit/mirrors-isort/issues/9#issuecomment-624404082
          - --filter-files
  - repo: https://github.com/psf/black
    rev: 22.3.0
    hooks:
      - id: black
        language_version: python3
  - repo: https://github.com/pycqa/flake8.git
    rev: 4.0.1
    hooks:
      - id: flake8
        language_version: python3
        additional_dependencies:
          - flake8-2020>=1.6.0
          - flake8-docstrings>=1.5.0
          - flake8-pytest-style>=1.2.2
          - flake8-rst-docstrings>=0.2.3
          - flake8-rst>=0.8.0
  - repo: https://github.com/pre-commit/mirrors-mypy
    rev: v0.950
    hooks:
      - id: mypy
        # empty args needed in order to match mypy cli behavior
        args: ["--strict"]
        additional_dependencies:
          - cached_property
          - flaky
          - packaging
          - pytest
          - pytest-mock
          - subprocess-tee>=0.3.5
          - types-PyYAML
          - types-pkg_resources
  - repo: https://github.com/pycqa/pylint
    rev: v2.13.8
    hooks:
      - id: pylint
        additional_dependencies:
          - PyYAML
          - flaky
          - pytest
          - typing_extensions
  # Keep last due to being considerably slower than the others:
  - repo: local
    hooks:
      - id: pip-compile-upgrade
        # To run it execute: `pre-commit run pip-compile-upgrade --hook-stage manual`
        name: Upgrade contraints files and requirements
        files: ^(setup\.py|setup\.cfg|constraints\.txt)$
        language: python
        entry: python -m piptools compile --upgrade -q --extra test --output-file=constraints.txt setup.cfg
        pass_filenames: false
        stages:
          - manual
        additional_dependencies:
          - pip-tools>=6.5.1
      - id: pip-compile-docs-upgrade
        name: Upgrade contraints files and requirements for docs
        files: ^(setup\.py|setup\.cfg|docs\/requirements\.(txt|in))$
        language: python
        entry: python -m piptools compile --upgrade -q docs/requirements.in --output-file=docs/requirements.txt setup.cfg
        pass_filenames: false
        stages:
          - manual
        additional_dependencies:
          - pip-tools>=6.5.1
      - id: pip-compile
        name: Check contraints files and requirements
        files: ^(setup\.py|setup\.cfg|constraints\.txt)$
        language: python
        entry: python -m piptools compile -q --extra test --output-file=constraints.txt setup.cfg
        pass_filenames: false
        additional_dependencies:
          - pip-tools>=6.5.1
      - id: pip-compile-docs
        name: Check contraints files and requirements for docs
        files: ^(setup\.py|setup\.cfg|docs\/requirements\.(txt|in))$
        language: python
        entry: python -m piptools compile -q docs/requirements.in --output-file=docs/requirements.txt setup.cfg
        pass_filenames: false
        additional_dependencies:
          - pip-tools>=6.5.1
