Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: python
python:
- "2.7"
install: pip install nose2
install: pip install pylint nose2
before_script:
- git config --global user.email "you@example.com"
- git config --global user.name "Your Name"
Expand Down
4 changes: 2 additions & 2 deletions git-pylint-commit-hook
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ def main():
help='Path to pylint executable. Default: pylint')
parser.add_argument(
'--pylintrc',
default='.pylintrc',
help=(
'Path to pylintrc file. Options in the pylintrc will '
'override the command line parameters. Default: .pylintrc'))
'override the command line parameters. Default: pylint'
'search order'))
parser.add_argument(
'--pylint-params',
help='Custom pylint parameters to add to the pylint command')
Expand Down
9 changes: 8 additions & 1 deletion git_pylint_commit_hook/commit_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import collections
import ConfigParser

# Avoid collision with other things called 'pylint'
import pylint.config as pylint_config


ExecutionResult = collections.namedtuple(
'ExecutionResult',
Expand Down Expand Up @@ -82,7 +85,7 @@ def _parse_score(pylint_output):


def check_repo(
limit, pylint='pylint', pylintrc='.pylintrc', pylint_params=None,
limit, pylint='pylint', pylintrc=None, pylint_params=None,
suppress_report=False):
""" Main function doing the checks

Expand All @@ -97,6 +100,10 @@ def check_repo(
:type suppress_report: bool
:param suppress_report: Suppress report if score is below limit
"""
if pylintrc is None:
# If no config is found, use the old default '.pylintrc'
pylintrc = pylint_config.find_pylintrc() or '.pylintrc'

# List of checked files and their results
python_files = []

Expand Down