Skip to content

Commit 762d437

Browse files
Use pylint to find pylintrc by default
1 parent 0b967a4 commit 762d437

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: python
22
python:
33
- "2.7"
4-
install: pip install nose2
4+
install: pip install pylint nose2
55
before_script:
66
- git config --global user.email "you@example.com"
77
- git config --global user.name "Your Name"

git-pylint-commit-hook

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ def main():
3737
help='Path to pylint executable. Default: pylint')
3838
parser.add_argument(
3939
'--pylintrc',
40-
default='.pylintrc',
4140
help=(
4241
'Path to pylintrc file. Options in the pylintrc will '
43-
'override the command line parameters. Default: .pylintrc'))
42+
'override the command line parameters. Default: pylint'
43+
'search order'))
4444
parser.add_argument(
4545
'--pylint-params',
4646
help='Custom pylint parameters to add to the pylint command')

git_pylint_commit_hook/commit_hook.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
import collections
88
import ConfigParser
99

10+
# Avoid collision with other things called 'pylint'
11+
import pylint.config as pylint_config
12+
1013

1114
ExecutionResult = collections.namedtuple(
1215
'ExecutionResult',
@@ -82,7 +85,7 @@ def _parse_score(pylint_output):
8285

8386

8487
def check_repo(
85-
limit, pylint='pylint', pylintrc='.pylintrc', pylint_params=None,
88+
limit, pylint='pylint', pylintrc=None, pylint_params=None,
8689
suppress_report=False):
8790
""" Main function doing the checks
8891
@@ -97,6 +100,10 @@ def check_repo(
97100
:type suppress_report: bool
98101
:param suppress_report: Suppress report if score is below limit
99102
"""
103+
if pylintrc is None:
104+
# If no config is found, use the old default '.pylintrc'
105+
pylintrc = pylint_config.find_pylintrc() or '.pylintrc'
106+
100107
# List of checked files and their results
101108
python_files = []
102109

0 commit comments

Comments
 (0)