Skip to content
Open
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 git-pylint-commit-hook
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ LICENSE:
http://www.apache.org/licenses/LICENSE-2.0.html
"""

VERSION = '2.1.2'
VERSION = '2.1.3'

import argparse
import sys
Expand Down
17 changes: 16 additions & 1 deletion git_pylint_commit_hook/commit_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ def _is_python_file(filename):
return 'python' in first_line and '#!' in first_line


def _is_ignored(filename, ignore_pattern_text_list):
for ignore_pattern_text in ignore_pattern_text_list:
if re.findall(ignore_pattern_text, filename):
return True
return False


_SCORE_REGEXP = re.compile(
r'^Your\ code\ has\ been\ rated\ at\ (\-?[0-9\.]+)/10')

Expand Down Expand Up @@ -157,10 +164,18 @@ def check_repo(

# Stash any unstaged changes while we look at the tree
with _stash_unstaged():

# Ignore files
params = pylint_params.split()
ignore_pattern_text_list = []
for param in params:
if 'ignore' in param:
ignore_pattern_text_list.extend(param.split('=')[1].split(','))

# Find Python files
for filename in _get_list_of_committed_files():
try:
if _is_python_file(filename):
if _is_python_file(filename) and not _is_ignored(filename, ignore_pattern_text_list):
python_files.append((filename, None))
except IOError:
print('File not found (probably deleted): {}\t\tSKIPPED'.format(
Expand Down
2 changes: 1 addition & 1 deletion git_pylint_commit_hook/settings.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[general]
version: 2.1.2
version: 2.1.3
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name='git-pylint-commit-hook',
version='2.1.2',
version='2.1.3',
license='Apache License, Version 2.0',
description='Git commit hook that checks Python files with pylint',
author='Sebastian Dahlgren',
Expand Down