#
# Git pre-commit framework config for Logisim-evolution project.
#
# See: https://github.com/logisim-evolution/logisim-evolution/blob/master/docs/developers.md
# for more information and setup guide.
#
# See https://pre-commit.com for more information about pre-commit.
# See https://pre-commit.com/hooks.html for more available hooks.
#
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.0.1
    hooks:
      # Prevent giant files from being committed
      - id: check-added-large-files
        args: ['--maxkb=100']
      # This hook checks yaml files for parseable syntax
      - id: check-yaml
      # Check for files that would conflict in case-insensitive filesystems
      - id: check-case-conflict
      # Ensures that (non-binary) executables have a shebang.
      - id: check-executables-have-shebangs
      # Check for files that contain merge conflict strings
      - id: check-merge-conflict
      # Prevent addition of new git submodules
      - id: forbid-new-submodules
      # Replaces or checks mixed line ending
      - id: mixed-line-ending
        args: ['--fix=no']

  - repo: https://github.com/pre-commit/pygrep-hooks
    rev: v1.9.0
    hooks:
      # Forbid files which have a UTF-8 Unicode replacement character
      - id: text-unicode-replacement-char

  - repo: https://github.com/jumanjihouse/pre-commit-hooks
    rev: 2.1.5
    hooks:
      # Non-executable shell script filename ends in .sh
      - id: script-must-have-extension

  - repo: https://github.com/Lucas-C/pre-commit-hooks
    rev: v1.1.10
    hooks:
      # Forbid files containing CRLF end-lines to be committed
      - id: forbid-crlf
        exclude: gradlew.bat

  - repo: https://github.com/MarcinOrlowski/pre-commit-hooks
    rev: 1.3.0
    hooks:
      # Checks modified Java files with Checkstyle linter.
      - id: checkstyle-jar
      # This hook trims trailing whitespace.
      - id: trailing-whitespaces
        exclude_types: ['xml','png','jpeg','svg','jar']
        args: ['--markdown-linebreak-ext=md', '--fix=yes']
      # Ensures that a file is either empty, or ends with one newline
      - id: end-of-file
        exclude_types: ['xml','png','jpeg','svg','jar']
        args: ['--fix=yes']
