Giter Club home page Giter Club logo

git-pylint-commit-hook's Introduction

git-pylint-commit-hook

Pre-commit hook for Git checking Python code quality. The hook will check files ending with .py or that has a she bang (#!) containing python.

The script will try to find pylint configuration files in the order determined by pylint. It also looks for a [pre-commit-hook] section in the pylint configuration for commit hook specific options.

Installation

Install via PyPI

pip install git-pylint-commit-hook

Usage

The commit hook will automatically be called when you are running git commit. If you want to skip the tests for a certain commit, use the -n flag, git commit -n.

Configuration

Settings are loaded by default from the .pylintrc file in the root of your repo.

[pre-commit-hook]
command=custom_pylint
params=--rcfile=/path/to/another/pylint.rc
limit=8.0

command is for the actual command, for instance if pylint is not installed globally, but is in a virtualenv inside the project itself.

params lets you pass custom parameters to pylint

limit is the lowest value which you want to allow for a pylint score. Any lower than this, and the script will fail and won't commit.

Any of these can be bypassed directly in the pre-commit hook itself. You can also set a different default place to look for the pylintrc file.

Running tests

The test suite requires nose2 to be installed. Install it with pip install nose2, then run the tests by executing the following command (in the project root folder):

nose2

Requirements

This project supports Python 2.7 and Python 3.5. Please install other requirements via

pip install -r requirements.txt

Release notes

2.5.1 (2018-10-24)

  • Check if a file is ignored before checking if it's a python file #69

2.5.0 (2018-07-27)

  • Don't fail files with pylint: skip-file #66

2.4.0 (2018-03-12)

  • Skip pylintrc parameter, if file not present #62

2.3.0 (2018-02-24)

  • Make stashing optional #56
  • Bug fix for pylinit 1.7.x #57

2.2.2 (2017-05-19)

  • Let the wrapper script call sys.exit #55 contributed by coldnight

2.2.1 (2016-09-27)

2.2.0 (2016-09-08)

2.1.1 (2016-02-26)

2.1.0 (2016-01-18)

2.0.9 (2014-10-16)

2.0.7 (2014-10-16)

2.0.5 (2014-10-08)

2.0.5 (2014-05-06)

2.0.4 (2014-05-01)

2.0.3 (2014-02-07)

  • Fixed error in decimal representation

2.0.1 (2013-12-08)

2.0.0 (2013-12-08)

  • Documentation updated and moved to Read The Docs
  • git-pylint-commit-hook is now a regular command
  • Installation via PyPI: pip install git-pylint-commit-hook
  • Configurable using command line parameters. See the documentation for details

1.0.0 (2013-10-13)

  • Added support for default .pylintrc file, and also for loading our own options from there.

0.8 (2013-01-09)

0.7 (2012-12-07)

  • Bug when skipping init.py files fixed. Wrong path was checked under some circumstanses

0.6 (2012-12-04)

0.5 (2012-12-01)

0.4 (2012-11-30)

0.3 (2012-11-18)

  • Fixed bug with non-python files getting checked, if they contained python on the first row

0.2 (2012-11-16)

  • Added support for handling moved or deleted files

0.1 (2012-11-09)

  • Initial release of the commit hook

git-pylint-commit-hook's People

Contributors

sebdah avatar lagelalegal avatar sandipagarwal avatar nicholasbishop avatar volviq avatar evverx avatar evanunderscore avatar eventuallyc0nsistent avatar adamn avatar jwkvam avatar rmedranollamas avatar wlwg avatar coldnight avatar

Watchers

James Cloos avatar  avatar

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.