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.


Using pre-commit-crocodile hooks

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

# pre-commit repositories
repos:

  # Repository: pre-commit-crocodile
  - repo: https://gitlab.com/RadianDevCore/tools/pre-commit-crocodile
    rev: X.Y.Z # Adapt to latest release tag
    hooks:
      - id: ...

prepare-commit-message

Automatically prepare the commit message based on changed sources before manual edition :

  • Sources / .pre-commit-config.yaml
      # Repository: pre-commit-crocodile
      - repo: ...
        ...
        hooks:
          - id: prepare-commit-message
    
  • Launched automatically by Git upon prepare-commit-msg stage using pre-commit

  • Parse Changes to be committed: to automatically prepare a type(scope): ... title
  • Commit messages implementation derived from Conventional Commits specifications
  • Automatically detect and prepare templates like ci(gitlab-ci):, docs(readme):, build(makefile): or docs(changelog):
  • Automatically evaluate sources specific scopes, for example files or folders under src/, or recipe folders in Yocto recipes-.../ sources
  • Message body is automatically inserted to help developers document their commits or link to a related issue
  • Commits with sign-off messages automatically receive a --- separator for readability on GitLab

check-yaml-ruamel-pure

Check YAML files using ruamel.yaml pure Python implementation :

  • Sources / .pre-commit-config.yaml
      # Repository: pre-commit-crocodile
      - repo: ...
        ...
        hooks:
          - id: check-yaml-ruamel-pure
    
  • Specifically created to use the pure Python implementation of ruamel.yaml

  • Recommended here by the maintainer (Anthon van der Neut)
  • Use this hook if check-yaml raises these parsing failures :
    ruamel.yaml.scanner.ScannerError: while scanning a plain scalar, found unexpected ':'
    
  • Drop-in alternative to the check-yaml original hook's --unsafe mode