Code Monkey home page Code Monkey logo

git-pre-commit-hook's Introduction

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:

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

  1. Fork git-pre-commit-hook

  2. Clone your fork

  3. Install tox:

    pip install tox
    
  4. Create development environment:

    tox -e devenv
    source devenv/bin/activate
    
  5. Edit code

  6. Run tests:

    tox
    
  7. Send pull request

Links

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.