• Stars
    star
    143
  • Rank 249,756 (Top 6 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 11 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Git pre-commit hook to check Python code quality with pylint. You can use this hook to prohibit Python code with a bad syntax to be checked in.

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.6.1 (2022-02-13)

  • Skip binary files #76
  • Fix PyPI project URL #74

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

More Repositories

1

dynamic-dynamodb

Dynamic DynamoDB provides auto scaling for AWS DynamoDB
Python
615
star
2

vim-delve

Neovim / Vim integration for Delve
Vim Script
489
star
3

scrapy-mongodb

MongoDB pipeline for Scrapy. This module supports both MongoDB in standalone setups and replica sets. scrapy-mongodb will insert the items to MongoDB as soon as your spider finds data to extract.
Python
355
star
4

goldie

Golden file testing for Go
Go
219
star
5

meteor-chat-tutorial

Example Meteor chat application supporting GitHub authentication.
JavaScript
186
star
6

aws-ec2-assign-elastic-ip

Automatically assign Elastic IPs to AWS EC2 Auto Scaling Group instances
Python
176
star
7

dotfiles

My dotfiles
Vim Script
130
star
8

automated-ebs-snapshots

Script for managing automated AWS EBS snapshots
Python
89
star
9

meteor-autocompletion

Autocompletion using data from MeteorJS collections
JavaScript
48
star
10

markdown-toc

Table of Contents generator for Markdown
Go
22
star
11

pok3r-layout

Vortex Pok3r layout for Linux users
16
star
12

elliot.js

Near real time graph library, see web page or demo.html for examples
JavaScript
11
star
13

dynamodb-config-store

Store your configuration in DynamoDB
Python
11
star
14

vim-ide

Sebastian's vim IDE
Vim Script
8
star
15

password-generator

Simple password generator module for Python
Python
8
star
16

yayson

Yay! Beautiful JSON on the command line!
Python
3
star
17

procmon

Simple utility for checking if processes are running
Python
3
star
18

markdown-docs

markdown-docs is a documentation generator for projects using Markdown. The problem with having Markdown files spread around your project is that it is hard to get an overview of all your documentation. markdown-docs solves this by collecting all of your Markdown files into one browsable HTML hierarchy.
Python
3
star
19

github-kanban

JavaScript
2
star
20

python-inspector

Used to track down which Python module and script that called your method / function. It will show you the exact Python file, line number and the actual line that made the call. The module is plug'n'playable, just import it and place a non-interfering hook in your code.
Python
2
star
21

relic

AWS Cloud management tool written in Python 2.7 and Django
JavaScript
1
star
22

recharged

Electrical vehicle charging system
Go
1
star
23

watchtower

Pythonic monitoring software
Python
1
star
24

chartista.js

JavaScript library for graphing
JavaScript
1
star
25

answering-robot

Fooling around with Python and text searching
Python
1
star
26

meteor-parent-data-example

Example showing how to access parent data in MeteorJS.
JavaScript
1
star