Skip to content

Commit

Permalink
Merge 5e86a27 into 9f5005e
Browse files Browse the repository at this point in the history
  • Loading branch information
do3cc committed Sep 20, 2015
2 parents 9f5005e + 5e86a27 commit 060ff3a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 5 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ Change history
- Remove leftovers from utf-8 checker removal.
[gforcada]

- Add a filter to the pre commit hook to only show failures and only show problems in files that are being modified.
It does not limit errors to the code pieces you modified, only whole files are filtered.
http://www.goodreads.com/quotes/65111-but-the-real-way-to-get-happiness-is-by-giving
[do3cc]

- Remove imports checker,
`flake8-isort <https://pypi.python.org/pypi/flake8-isort>`_
does the same job.
Expand All @@ -40,7 +45,6 @@ Change history
- Fix typo on test that prevented ipdb imports from being found.
[hvelarde]


2.0.2 (2015-09-03)
------------------

Expand Down
13 changes: 12 additions & 1 deletion plone/recipe/codeanalysis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,18 @@ def install_pre_commit_hook(self):
os.mkdir(git_hooks_directory)

with open(git_hooks_directory + '/pre-commit', 'w') as output_file:
output_file.write('#!/bin/bash\nbin/code-analysis')
# The last or true message is necessary, because
# an empty pipe is falsy. Having no issues would prevent
# your commit without it
changed_files = 'git diff --cached --name-only --diff-filter=ACM'
output_file.write('#!/bin/bash\n' + changed_files +
' | grep --extended-regexp . > /dev/null'
' && bin/code-analysis'
' | grep --extended-regexp --color=never'
' `' + changed_files +
' | tr "\\n" "|"'
' | sed --expression "s/|$/|failure/"`'
' || true')
subprocess.call([
'chmod',
'775',
Expand Down

0 comments on commit 060ff3a

Please sign in to comment.