Skip to content

pre-commit-crocodile

Release Python Downloads License
Build Bugs Code Smells Coverage Lines of Code Quality Gate Status
pre-commit Commitizen friendly gcil pre-commit-crocodile

Git hooks intended for developers using pre-commit and commitizen.


Configurations for pre-commit

Sources / .pre-commit-config.yaml
# pre-commit configurations
default_install_hook_types:
  - commit-msg
  - pre-commit
  - pre-push
  - prepare-commit-msg
default_stages:
  - commit-msg
  - pre-commit
  - pre-push
  - prepare-commit-msg
minimum_pre_commit_version: 3.8.0

# pre-commit exclusions
exclude: >
  (?x)(
    ^archives/|
    \.drawio$|
    \.patch$|
    \.svg$|
    \.vhd$|
    \.xci$|
    \.xdc$|
    eicar\..*$|
    CHANGELOG.md$|
    COPYING.*$|
    LICENSE.*$|
    README\.md$
  )

# pre-commit repositories
repos:

  # Repository: pre-commit
  - repo: meta
    hooks:
      - id: check-hooks-apply
      # - id: check-useless-excludes

  # Repository: pre-commit-hooks
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.6.0
    hooks:
      - id: check-added-large-files
        args: ['--maxkb=500']
      - id: check-case-conflict
        exclude: >
          (?x)(
            \.nmconnection$
          )
      - id: check-executables-have-shebangs
      - id: check-json
      - id: check-merge-conflict
      # - id: check-toml
      # - id: check-xml
      - id: check-yaml
        args: ['--unsafe']
      - id: destroyed-symlinks
        stages: [commit, push, manual] # Issue: https://github.com/pre-commit/pre-commit-hooks/pull/1085
      # - id: detect-private-key
      - id: double-quote-string-fixer
      - id: end-of-file-fixer
      - id: mixed-line-ending
      - id: trailing-whitespace
        args: ['--markdown-linebreak-ext=md']

  # Repository: pre-commit-hooks
  - repo: https://github.com/pre-commit/pygrep-hooks
    rev: v1.10.0
    hooks:
      - id: python-check-blanket-type-ignore
      - id: python-no-eval

  # Repository: commitizen
  - repo: https://github.com/commitizen-tools/commitizen
    rev: v3.29.0
    hooks:
      - id: commitizen
      - id: commitizen-branch
        entry: cz
        args: [--no-raise, '3', check, --rev-range, origin/HEAD..HEAD]
        stages:
          - push

  # Repository: pre-commit-crocodile
  - repo: local
    hooks:
      - id: check-yaml-ruamel-pure
        name: Check YAML (ruamel.yaml pure Python)
        entry: python ./src/hooks/check_yaml_ruamel_pure.py
        types: [yaml]
        args: []
        language: python
        description: Check YAML (ruamel.yaml pure Python implementation)
        stages:
          - commit
          - push
          - manual
        additional_dependencies:
          - ruamel.yaml>=0.18.6
      - id: prepare-commit-message
        name: Prepare commit message automatically
        entry: python ./src/hooks/prepare_commit_message.py
        args: []
        language: python
        description: Automatically prepare the commit message for manual edition
        stages:
          - prepare-commit-msg
        additional_dependencies:
          - PyYAML>=6.0

  # Repository: gcil
  - repo: https://gitlab.com/RadianDevCore/tools/gcil
    rev: 9db7ca21
    hooks:
      - id: run-gcil-push
        name: Run GitLab CI job with gcil (codestyle)
        description: Automatically run GitLab CI job with gcil (codestyle)
        args:
          - 'codestyle'
      - id: run-gcil-push
        name: Run GitLab CI job with gcil (lint)
        description: Automatically run GitLab CI job with gcil (lint)
        args:
          - 'lint'
      - id: run-gcil-push
        name: Run GitLab CI job with gcil (typings)
        description: Automatically run GitLab CI job with gcil (typings)
        args:
          - 'typings'