## Quote https://pre-commit.com/
## > We built pre-commit to solve our hook issues. It is a multi-language package manager for pre-commit hooks. You specify a list of hooks you want and pre-commit manages the installation and execution of any hook written in any language before every commit. pre-commit is specifically designed to not require root access. If one of your developers doesn't have node installed but modifies a JavaScript file, pre-commit automatically handles downloading and building node to run eslint without root.
##
## Scary.
## Therefore not in use.
## Using instead:
#usr/bin/dm-precommit-bare

minimum_pre_commit_version: '4.2.0'
fail_fast: false
## Default to 'all'.
#default_stages: [pre-commit, pre-merge-commit, manual]

## Quote https://pre-commit.com/
## > A local hook must define id, name, language, entry, and files / types as specified under Creating new hooks.

## files
## (optional: default '') the pattern of files to run on.
##
## The patterns for files and exclude are python regular expressions and are matched with re.search.
##

repos:
- repo: local
  hooks:
  - id: check-added-large-files
    name: check for added large files
    entry: check-added-large-files
    language: system
    files: ''

  - id: check-ast
    name: check python ast
    entry: check-ast
    language: system
    types: [python]

  - id: check-builtin-literals
    name: check builtin type constructor use
    entry: check-builtin-literals
    language: system
    types: [python]

  - id: check-case-conflict
    name: check for case conflicts
    entry: check-case-conflict
    language: system
    files: ''

   ## Quote https://github.com/pre-commit/pre-commit-hooks
   ## check-docstring-first: fundamentally flawed, deprecated without replacement.
  # - id: check-docstring-first
  #   name: check docstring is first
  #   entry: check-docstring-first
  #   language: system
  #   types: [python]

  - id: check-executables-have-shebangs
    name: check that executables have shebangs
    entry: check-executables-have-shebangs
    language: system
    types: [text, executable]

  - id: check-json
    name: check json
    entry: check-json
    language: system
    types: [json]

  - id: check-merge-conflict
    name: check for merge conflicts
    entry: check-merge-conflict
    language: system
    types: [text]

  - id: check-shebang-scripts-are-executable
    name: check that scripts with shebangs are executable
    entry: check-shebang-scripts-are-executable
    language: system
    types: [text]

  - id: check-symlinks
    name: check for broken symlinks
    entry: check-symlinks
    language: system
    types: [symlink]

  - id: check-toml
    name: check toml
    entry: check-toml
    language: system
    types: [toml]

  - id: check-vcs-permalinks
    name: check vcs permalinks
    entry: check-vcs-permalinks
    language: system
    types: [text]

  - id: check-xml
    name: check xml
    entry: check-xml
    language: system
    types: [xml]

  - id: check-yaml
    name: check yaml
    entry: check-yaml
    language: system
    types: [yaml]

  - id: debug-statements
    name: debug statements (python)
    entry: debug-statement-hook
    language: system
    types: [python]

  - id: destroyed-symlinks
    name: detect destroyed symlinks
    entry: destroyed-symlinks
    language: system
    types: [file]

  - id: detect-aws-credentials
    name: detect aws credentials
    entry: detect-aws-credentials
    language: system
    types: [text]
    args: [--allow-missing-credentials]

  - id: detect-private-key
    name: detect private key
    entry: detect-private-key
    language: system
    types: [text]

  - id: double-quote-string-fixer
    name: fix double quoted strings
    entry: double-quote-string-fixer
    language: system
    types: [python]

  - id: end-of-file-fixer
    name: fix end of files
    entry: end-of-file-fixer
    language: system
    types: [text]

  - id: file-contents-sorter
    name: file contents sorter
    entry: file-contents-sorter
    language: system
    files: '^$'
    # Change '^$' to a real path regex to opt in, for example:
    # files: '^(debian/control|docs/allowlist\.txt)$'

  ## check-byte-order-marker
  ## Not using.
  ## Quote https://github.com/pre-commit/pre-commit-hooks/blob/main/.pre-commit-hooks.yaml
  ## description: (removed) use fix-byte-order-marker instead.
  - id: fix-byte-order-marker
    name: fix utf-8 byte order marker
    entry: fix-byte-order-marker
    language: system
    types: [text]

  - id: forbid-new-submodules
    name: forbid new submodules
    entry: forbid-new-submodules
    language: system
    types: [directory]

  - id: mixed-line-ending
    name: mixed line ending
    entry: mixed-line-ending
    language: system
    types: [text]
    # Default upstream behavior is autofix.
    args: [--fix=no]

  - id: name-tests-test
    name: python tests naming
    entry: name-tests-test
    language: system
    files: '(^|/)tests/.+\.py$'

  - id: no-commit-to-branch
    name: don't commit to branch
    entry: no-commit-to-branch
    language: system
    files: ''
    pass_filenames: false
    always_run: true
    # Optional explicit protection:
    # args: [--branch, main, --branch, master]
    ## Quote: https://github.com/pre-commit/pre-commit-hooks
    ## Both main and master are protected by default if no branch argument is set.

  - id: pretty-format-json
    name: pretty format json
    entry: pretty-format-json
    language: system
    types: [json]
    # Check-only by default. Add '--autofix' if desired.
    # args: [--autofix]

  - id: requirements-txt-fixer
    name: fix requirements.txt
    entry: requirements-txt-fixer
    language: system
    files: '(requirements|constraints).*\.txt$'

  - id: sort-simple-yaml
    name: sort simple yaml files
    entry: sort-simple-yaml
    language: system
    files: '^$'
    # Change '^$' to a real path regex to opt in, for example:
    # files: '^config/simple/'

  - id: trailing-whitespace
    name: trim trailing whitespace
    entry: trailing-whitespace-fixer
    language: system
    types: [text]
    # Optional for markdown hard linebreaks:
    # args: [--markdown-linebreak-ext=md]

  # - id: unicode-staged
  #   name: unicode check staged diff
  #   entry: check-staged-diff-for-unicode
  #   language: system
  #   files: ''
  #   pass_filenames: false
  #   always_run: true
  #   stages: [pre-commit, manual]

  - id: unicode-merged-ref
    name: unicode check merged ref
    entry: check-ref-commits-for-unicode
    args: [MERGE_HEAD]
    language: system
    files: ''
    pass_filenames: false
    always_run: true
    stages: [pre-merge-commit, manual]

## "Special"
## pre-commit-hooks-removed
