pre-commit hook for Git
Project description
Hook that blocks bad commits. Useful for Python-development.
Installation
You can install, upgrade, uninstall git-pre-commit-hook with these commands:
$ pip install git-pre-commit-hook $ pip install --upgrade git-pre-commit-hook $ pip uninstall git-pre-commit-hook
Features
Work fine with initial commit.
Work fine with all filenames.
Work with index contents instead of working copy.
Plugin architecture: adding new checks is easy.
Builtin plugins for:
validate json files
validate Python-code with flake8 ( mccabe plugin is enabled ) and pep8-naming
validate Python-code with frosted
validate .rst files with restructuredtext_lint
validate .ini files with configparser
validate .yaml files with PyYAML
validate .xml files with xml.etree.ElementTree
check filesize
Examples
Install hook to current Git-repository:
git-pre-commit-hook install \ --plugin flake8 \ --plugin frosted \ --plugin json \ --plugin file_size \ --plugin rst \ --plugin yaml
Installed hook rejects commits:
if any file has size greater than 10MB
if files with .json extension contains invalid JSON
if Python-code doesn’t pass check with flake8 (with pep8-naming)
if Python-code doesn’t pass check with frosted
if files with .rst extension contains invalid RST
if files with .yaml extension contains invalid YAML
List available plugins:
git-pre-commit-hook list-plugins
Show information about plugin:
git-pre-commit-hook show-plugin-info json
Contributing
Fork git-pre-commit-hook
Clone your fork
Install tox:
pip install tox
Create development environment:
tox -e devenv source devenv/bin/activate
Edit code
Run tests:
tox
Send pull request
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for git-pre-commit-hook-0.0.11.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | abed7d0713c652464a475392d90c30f3556aa8319f27772f009acc6ba68e7bfc |
|
MD5 | 48b259f63b593f9da6f47bc90b5abd9f |
|
BLAKE2b-256 | ac9446dc93172fbe32671b0ead620555b4d97322a92a731c59bb77885da18a51 |