---
# File .pre-commit-config.yaml
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
# See https://github.com/pre-commit/identify/blob/main/identify/extensions.py for the list of file types by extension

exclude: ^FIXME/.*$                       # ignore all files matching the regexp
fail_fast: true                           # stop at the first error
repos:

  # Conventions (e.g. naming, commit message, etc).
  - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
    rev: v9.11.0
    hooks:
      - id: commitlint
        stages:                           # limit hook to specific stages
          - commit-msg
        additional_dependencies: ['@commitlint/config-conventional']

  # Files style.
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.5.0
    hooks:
      - id: check-added-large-files
      - id: check-json
      - id: check-yaml
        args: [--allow-multiple-documents]
      - id: check-xml
      - id: trailing-whitespace
        args:
          - --markdown-linebreak-ext=md   # ignore markdown's line break
      - id: end-of-file-fixer

  # Files contents (e.g. secrets).
  - repo: https://github.com/sirwart/ripsecrets
    rev: v0.1.7
    hooks:
      - id: ripsecrets

  # Files linting.
  - repo: https://github.com/markdownlint/markdownlint
    rev: v0.12.0
    hooks:
      - id: markdownlint
        types:                            # limit hook to target file types
          - markdown
        args:
          - -r "~MD013"                   # ignore line-length rule
  - repo: https://github.com/tcort/markdown-link-check
    rev: v3.11.2
    hooks:
      - id: markdown-link-check
  - repo: https://github.com/adrienverge/yamllint
    rev: v1.33.0
    hooks:
      - id: yamllint
  - repo: https://github.com/ansible-community/ansible-lint
    rev: v6.22.1
    hooks:
      - id: ansible-lint
        name: ansilint                    # use an alias
  - repo: https://github.com/hadolint/hadolint
    rev: v2.12.1-beta
    hooks:
      - id: hadolint
