Coder Social home page Coder Social logo

pre-commit / pre-commit Goto Github PK

View Code? Open in Web Editor NEW
12.1K 86.0 764.0 4.02 MB

A framework for managing and maintaining multi-language pre-commit hooks.

Home Page: https://pre-commit.com

License: MIT License

Python 97.07% Shell 0.56% Ruby 0.04% Go 0.01% Rust 0.01% Dockerfile 0.07% Perl 0.02% R 2.19% Lua 0.04%
git pre-commit python linter refactoring

pre-commit's Introduction

build status pre-commit.ci status

pre-commit

A framework for managing and maintaining multi-language pre-commit hooks.

For more information see: https://pre-commit.com/

pre-commit's People

Contributors

asottile avatar barrysteyn avatar benasher44 avatar blarghmatey avatar chriskuehl avatar danielchabrowski avatar expobrain avatar geieredgar avatar georgeyk avatar hackedd avatar jalessio avatar jeffreyrack avatar jessebona avatar kevinhock avatar lorenzwalthert avatar lucas-c avatar m-rsha avatar marqueewinq avatar mblayman avatar mjay-taskize avatar mxr avatar myrheimb avatar paulhfischer avatar pre-commit-ci[bot] avatar rkm avatar s0undt3ch avatar scop avatar struys avatar tdeo avatar yoavcaspi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pre-commit's Issues

UnicodeDecodeError in staged_files_only

$ pre-commit
[WARNING] Unstaged files detected.
[INFO] Stashing unstaged files to .../.pre-commit-files/patch1397853050.
Traceback (most recent call last):
  File ".../bin/pre-commit", line 9, in <module>
    load_entry_point('pre-commit==0.0.0', 'console_scripts', 'pre-commit')()
  File ".../lib/python2.6/site-packages/pre_commit/util.py", line 52, in wrapper
    return func(argv)
  File ".../lib/python2.6/site-packages/pre_commit/run.py", line 59, in run
    return commands.run(runner, args)
  File ".../lib/python2.6/site-packages/pre_commit/commands.py", line 254, in run
    with ctx:
  File "/usr/lib64/python2.6/contextlib.py", line 16, in __enter__
    return self.gen.next()
  File ".../lib/python2.6/site-packages/pre_commit/staged_files_only.py", line 32, in staged_files_only
    patch_file.write(diff_stdout)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 3795: ordinal not in range(128)

Implement color correctly

Commandline needs --color option which has 'always', 'never', 'auto' as options.

auto - Use sys.stdout.isatty()

Add way to temporarily/permanently disable hooks.

overcommit uses environment variables to do temporary skipping...

For instance:

SKIP=foo git commit will skip the foo hook

Whereas I've used a more-permanent switching with git config hooks.foo false in the past.

Considering both approaches, I think overcommit does this quite elegantly while focusing on only temporarily disabling hooks.

Add exclude pattern to hooks config

Optionally one should be able to exclude files.

Use case: I want python files but not files in vendor/

Config would look like

-   repo: git@foo:foo
    sha: 90abc...
    hooks:
    -    id: pyflakes
         files: \.py$
         exclude: ^vendor/

pre-commit crashes when running during unresolved merge conflict

I intentionally forced the following by making two branches conflict and then editing a file on that branch. pre-commit should fail-fast in a merge conflict situation.

$ git diff --exit-code
diff --cc foo.txt
index 8ff26e7,c148433..0000000
--- a/foo.txt
+++ b/foo.txt
@@@ -1,4 -1,5 +1,11 @@@
  asdf
++<<<<<<< HEAD
 +fdsa
 +yeah
 +yeah
++=======
+ asdf
+ asdf
+ asdf
+ 
++>>>>>>> derp
diff --git a/git_code_debt/generate.py b/git_code_debt/generate.py
index 12ceec6..967506e 100644
--- a/git_code_debt/generate.py
+++ b/git_code_debt/generate.py
@@ -12,6 +12,7 @@ from git_code_debt.logic import get_previous_sha
 from git_code_debt.logic import insert_metric_values
 from git_code_debt.repo_parser import RepoParser

+
 def get_metrics(diff, metric_parsers):
     def get_all_metrics(file_diff_stats):
         for metric_parser_cls in metric_parsers:
(py_env)[anthony@anthony-VirtualBox git-code-debt (herp|MERGING)]$ echo $?
1
(py_env)[anthony@anthony-VirtualBox git-code-debt (herp|MERGING)]$ pre-commit 
[WARNING] Unstaged files detected.
[INFO] Stashing unstaged files to /tmp/git-code-debt/.pre-commit-files/patch1397455577.
Traceback (most recent call last):
  File "/tmp/git-code-debt/py_env/bin/pre-commit", line 9, in <module>
    load_entry_point('pre-commit==0.0.0', 'console_scripts', 'pre-commit')()
  File "/tmp/git-code-debt/py_env/local/lib/python2.7/site-packages/pre_commit/util.py", line 52, in wrapper
    return func(argv)
  File "/tmp/git-code-debt/py_env/local/lib/python2.7/site-packages/pre_commit/run.py", line 59, in run
    return commands.run(runner, args)
  File "/tmp/git-code-debt/py_env/local/lib/python2.7/site-packages/pre_commit/commands.py", line 242, in run
    with ctx:
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/tmp/git-code-debt/py_env/local/lib/python2.7/site-packages/pre_commit/staged_files_only.py", line 35, in staged_files_only
    cmd_runner.run(['git', 'checkout', '--', '.'])
  File "/tmp/git-code-debt/py_env/local/lib/python2.7/site-packages/pre_commit/prefixed_command_runner.py", line 77, in run
    returncode, replaced_cmd, retcode, output=(stdout, stderr),
pre_commit.prefixed_command_runner.CalledProcessError: Command: ['git', 'checkout', '--', '.']
Return code: 1
Expected return code: 0
Output: (u'', u"error: path 'foo.txt' is unmerged\n")

(py_env)[anthony@anthony-VirtualBox git-code-debt (herp|MERGING)]$ 

pre-commit message is not incredibly useful when not on the path

When pre-commit is installed as the pre-commit hook for the repository and you've forgotten to source your virtualenv (or install at a system level) you get the following confusing message:

$ git commit
.git/hooks/pre-commit: line 3: pre-commit: command not found

Let's make this message better

Add autoupdate command to `pre-commit`

Autoupdate will:

for each repo in the pre-commit config:
    - fetch inside the repository
    - check the manifest at the tip of `master` to make sure all
        of the configured hooks still exist
    - if any of the hooks no  longer exist: abort with a useful
        error message
    - otherwise update pre-commit config for this repo to point
        at the tip of `master`

TypeError while instantiating LoggingHandler (2.6)

I assume this is new-style vs old-style classes being grumpy?

>>> from pre_commit.logging_handler import LoggingHandler
>>> LoggingHandler(True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../py_env/lib/python2.6/site-packages/pre_commit/logging_handler.py", line 19, in __init__
    super(LoggingHandler, self).__init__()
TypeError: super() argument 1 must be type, not classobj

Occasional flakiness of staged file stasher

It appears git diff-files is returning incorrectly in some case that I haven't been able to pinpoint.

It results in something like this (you can see however that all the files are staged):

$ pre-commit 
[WARNING] Unstaged files detected.
Stashing unstaged files to /home/anthony/workspace/pre-commit/.pre-commit-files/patch1397370090.
Trim Trailing Whitespace............................................Passed
Fix End of Files....................................................Passed
Check Yaml..........................................................Passed
Debug Statements (Python)...........................................Passed
Tests should end in _test.py........................................Passed
Pyflakes............................................................Passed
Validate Pre-Commit Config..........................................Passed
Validate Pre-Commit Manifest........................................Passed
[WARNING] Stashed changes conflicted with hook auto-fixes... Rolling back fixes...
Traceback (most recent call last):
  File "/home/anthony/workspace/pre-commit/venv-pre_commit/bin/pre-commit", line 9, in <module>
    load_entry_point('pre-commit==0.0.0', 'console_scripts', 'pre-commit')()
  File "/home/anthony/workspace/pre-commit/pre_commit/util.py", line 52, in wrapper
    return func(argv)
  File "/home/anthony/workspace/pre-commit/pre_commit/run.py", line 143, in run
    return _run(runner, args)
  File "/home/anthony/workspace/pre-commit/pre_commit/run.py", line 95, in _run
    return run_hooks(runner, args)
  File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/home/anthony/workspace/pre-commit/pre_commit/staged_files_only.py", line 51, in staged_files_only
    cmd_runner.run(['git', 'apply', patch_filename])
  File "/home/anthony/workspace/pre-commit/pre_commit/prefixed_command_runner.py", line 67, in run
    returncode, replaced_cmd, retcode, output=(stdout, stderr),
pre_commit.prefixed_command_runner.CalledProcessError: Command: ['git', 'apply', '/home/anthony/workspace/pre-commit/.pre-commit-files/patch1397370090']
Return code: 128
Expected return code: 0
Output: ('', 'fatal: unrecognized input\n')
$ git status
# On branch rebuild_venv
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   modified:   .gitignore
#   modified:   Makefile
#

The "stashed diff" is an empty file. I think the "fix" is to check if the diff contains anything before printing the warning message and entering the branch that isn't a noop context manager.

Add hook for checking .travis.yml and tox.ini

Mostly for environments. The environments in the tox.ini file specified as follows:

[tox]
envlist = py26,py27,py33,pypy

Should be represented in .travis.yml

language: python
env: # These should match the tox env list
    - TOXENV=py26
    - TOXENV=py27
    - TOXENV=py33
    - TOXENV=pypy

Tests fail when running as pre-commit step (but pass otherwise)

(py_env)asottile@asottile-Parallels-Virtual-Platform:~/workspace/pre-commit$ git commit --allow-empty -m "derp"
Trimming trailing whitespace...
Fixing line endings...
Py    - Pyflakes........................................................................................................................................................Success
Py    - ipdb............................................................................................................................................................Success
Py    - Test files should end in _test.py...............................................................................................................................Success
Py    - Use s.splitlines over s.split...................................................................................................................................Success
All   - No tabs.........................................................................................................................................................Success
Py    - Tests........................................................................................................................................................Failure(2)

rm -rf py_env
virtualenv py_env
New python executable in py_env/bin/python
Installing Setuptools..............................................................................................................................................................................................................................done.
Installing Pip.....................................................................................................................................................................................................................................................................................................................................done.
bash -c 'source py_env/bin/activate && \
        pip install -e . && \
        pip install -r requirements.txt'
Obtaining file:///home/asottile/workspace/pre-commit
  Running setup.py egg_info for package from file:///home/asottile/workspace/pre-commit
    deleting pre_commit.egg-info/entry_points.txt

Requirement already satisfied (use --upgrade to upgrade): argparse in /usr/lib/python2.7 (from pre-commit==0.0.0)
Downloading/unpacking plumbum (from pre-commit==0.0.0)
  Running setup.py egg_info for package plumbum

Downloading/unpacking simplejson (from pre-commit==0.0.0)
  Running setup.py egg_info for package simplejson

Installing collected packages: plumbum, simplejson, pre-commit
  Running setup.py install for plumbum

  Running setup.py install for simplejson
    building 'simplejson._speedups' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c simplejson/_speedups.c -o build/temp.linux-x86_64-2.7/simplejson/_speedups.o
    gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/simplejson/_speedups.o -o build/lib.linux-x86_64-2.7/simplejson/_speedups.so

  Running setup.py develop for pre-commit

    Creating /home/asottile/workspace/pre-commit/py_env/lib/python2.7/site-packages/pre-commit.egg-link (link to .)
    Adding pre-commit 0.0.0 to easy-install.pth file

    Installed /home/asottile/workspace/pre-commit
Successfully installed plumbum simplejson pre-commit
Cleaning up...
Requirement already satisfied (use --upgrade to upgrade): argparse in /usr/lib/python2.7 (from -r requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): plumbum in ./py_env/lib/python2.7/site-packages (from -r requirements.txt (line 2))
Downloading/unpacking pyyaml (from -r requirements.txt (line 3))
  Running setup.py egg_info for package pyyaml

Requirement already satisfied (use --upgrade to upgrade): simplejson in ./py_env/lib/python2.7/site-packages (from -r requirements.txt (line 4))
Downloading/unpacking coverage (from -r requirements.txt (line 7))
  Running setup.py egg_info for package coverage

    warning: no previously-included files matching '*.pyc' found anywhere in distribution
Downloading/unpacking ipdb (from -r requirements.txt (line 8))
  Downloading ipdb-0.8.zip
  Running setup.py egg_info for package ipdb

Downloading/unpacking mock (from -r requirements.txt (line 9))
  Running setup.py egg_info for package mock

    warning: no files found matching '*.png' under directory 'docs'
    warning: no files found matching '*.css' under directory 'docs'
    warning: no files found matching '*.html' under directory 'docs'
    warning: no files found matching '*.js' under directory 'docs'
Downloading/unpacking pyflakes (from -r requirements.txt (line 10))
  Downloading pyflakes-0.7.3.tar.gz
  Running setup.py egg_info for package pyflakes

Downloading/unpacking pytest (from -r requirements.txt (line 11))
  Running setup.py egg_info for package pytest

Downloading/unpacking ipython>=0.10 (from ipdb->-r requirements.txt (line 8))
  Running setup.py egg_info for package ipython

Downloading/unpacking py>=1.4.20 (from pytest->-r requirements.txt (line 11))
  Running setup.py egg_info for package py

Installing collected packages: pyyaml, coverage, ipdb, mock, pyflakes, pytest, ipython, py
  Running setup.py install for pyyaml
    checking if libyaml is compilable
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c build/temp.linux-x86_64-2.7/check_libyaml.c -o build/temp.linux-x86_64-2.7/check_libyaml.o
    checking if libyaml is linkable
    gcc -pthread build/temp.linux-x86_64-2.7/check_libyaml.o -lyaml -o build/temp.linux-x86_64-2.7/check_libyaml
    building '_yaml' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c ext/_yaml.c -o build/temp.linux-x86_64-2.7/ext/_yaml.o
    In file included from ext/_yaml.c:223:0:
    ext/_yaml.h:6:0: warning: "PyUnicode_FromString" redefined [enabled by default]
    /usr/include/python2.7/unicodeobject.h:281:0: note: this is the location of the previous definition
    ext/_yaml.c: In function ‘__pyx_pf_5_yaml_get_version_string’:
    ext/_yaml.c:1145:17: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
    ext/_yaml.c: In function ‘__pyx_pf_5_yaml_7CParser___init__’:
    ext/_yaml.c:2074:38: warning: passing argument 2 of ‘yaml_parser_set_input’ from incompatible pointer type [enabled by default]
    /usr/include/yaml.h:1367:1: note: expected ‘int (*)(void *, unsigned char *, size_t,  size_t *)’ but argument is of type ‘int (*)(void *, char *, int,  int *)’
    ext/_yaml.c:2272:45: warning: pointer targets in passing argument 2 of ‘yaml_parser_set_input_string’ differ in signedness [-Wpointer-sign]
    /usr/include/yaml.h:1341:1: note: expected ‘const unsigned char *’ but argument is of type ‘char *’
    ext/_yaml.c: In function ‘__pyx_f_5_yaml_7CParser__token_to_object’:
    ext/_yaml.c:3705:5: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Wpointer-sign]
    /usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:3705:5: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness [-Wpointer-sign]
    /usr/include/python2.7/unicodeobject.h:750:23: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:3718:5: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Wpointer-sign]
    /usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:3718:5: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness [-Wpointer-sign]
    /usr/include/python2.7/unicodeobject.h:750:23: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:4285:5: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Wpointer-sign]
    /usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:4285:5: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness [-Wpointer-sign]
    /usr/include/python2.7/unicodeobject.h:750:23: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:4339:5: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Wpointer-sign]
    /usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:4339:5: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness [-Wpointer-sign]
    /usr/include/python2.7/unicodeobject.h:750:23: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:4393:5: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Wpointer-sign]
    /usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:4393:5: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness [-Wpointer-sign]
    /usr/include/python2.7/unicodeobject.h:750:23: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:4406:5: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Wpointer-sign]
    /usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:4406:5: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness [-Wpointer-sign]
    /usr/include/python2.7/unicodeobject.h:750:23: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:4493:5: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness [-Wpointer-sign]
    /usr/include/python2.7/unicodeobject.h:750:23: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c: In function ‘__pyx_f_5_yaml_7CParser__event_to_object’:
    ext/_yaml.c:5909:9: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Wpointer-sign]
    /usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:5909:9: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness [-Wpointer-sign]
    /usr/include/python2.7/unicodeobject.h:750:23: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:5922:9: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Wpointer-sign]
    /usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:5922:9: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness [-Wpointer-sign]
    /usr/include/python2.7/unicodeobject.h:750:23: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:6088:5: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Wpointer-sign]
    /usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:6088:5: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness [-Wpointer-sign]
    /usr/include/python2.7/unicodeobject.h:750:23: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:6163:7: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Wpointer-sign]
    /usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:6163:7: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness [-Wpointer-sign]
    /usr/include/python2.7/unicodeobject.h:750:23: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:6200:7: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Wpointer-sign]
    /usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:6200:7: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness [-Wpointer-sign]
    /usr/include/python2.7/unicodeobject.h:750:23: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:6216:5: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness [-Wpointer-sign]
    /usr/include/python2.7/unicodeobject.h:750:23: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:6520:7: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Wpointer-sign]
    /usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:6520:7: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness [-Wpointer-sign]
    /usr/include/python2.7/unicodeobject.h:750:23: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:6557:7: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Wpointer-sign]
    /usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:6557:7: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness [-Wpointer-sign]
    /usr/include/python2.7/unicodeobject.h:750:23: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:6747:7: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Wpointer-sign]
    /usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:6747:7: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness [-Wpointer-sign]
    /usr/include/python2.7/unicodeobject.h:750:23: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:6784:7: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Wpointer-sign]
    /usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:6784:7: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness [-Wpointer-sign]
    /usr/include/python2.7/unicodeobject.h:750:23: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c: In function ‘__pyx_f_5_yaml_7CParser__compose_node’:
    ext/_yaml.c:8064:5: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Wpointer-sign]
    /usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:8064:5: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness [-Wpointer-sign]
    /usr/include/python2.7/unicodeobject.h:750:23: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:8284:5: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Wpointer-sign]
    /usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:8284:5: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness [-Wpointer-sign]
    /usr/include/python2.7/unicodeobject.h:750:23: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:8315:5: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Wpointer-sign]
    /usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:8315:5: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness [-Wpointer-sign]
    /usr/include/python2.7/unicodeobject.h:750:23: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:8346:5: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Wpointer-sign]
    /usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:8346:5: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness [-Wpointer-sign]
    /usr/include/python2.7/unicodeobject.h:750:23: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c: In function ‘__pyx_f_5_yaml_7CParser__compose_scalar_node’:
    ext/_yaml.c:8861:3: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness [-Wpointer-sign]
    /usr/include/python2.7/unicodeobject.h:750:23: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:9019:5: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Wpointer-sign]
    /usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:9019:5: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness [-Wpointer-sign]
    /usr/include/python2.7/unicodeobject.h:750:23: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c: In function ‘__pyx_f_5_yaml_7CParser__compose_sequence_node’:
    ext/_yaml.c:9461:5: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Wpointer-sign]
    /usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:9461:5: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness [-Wpointer-sign]
    /usr/include/python2.7/unicodeobject.h:750:23: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c: In function ‘__pyx_f_5_yaml_7CParser__compose_mapping_node’:
    ext/_yaml.c:9998:5: warning: pointer targets in passing argument 1 of ‘strlen’ differ in signedness [-Wpointer-sign]
    /usr/include/string.h:399:15: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c:9998:5: warning: pointer targets in passing argument 1 of ‘PyUnicodeUCS4_DecodeUTF8’ differ in signedness [-Wpointer-sign]
    /usr/include/python2.7/unicodeobject.h:750:23: note: expected ‘const char *’ but argument is of type ‘yaml_char_t *’
    ext/_yaml.c: In function ‘__pyx_pf_5_yaml_8CEmitter___init__’:
    ext/_yaml.c:11065:38: warning: passing argument 2 of ‘yaml_emitter_set_output’ from incompatible pointer type [enabled by default]
    /usr/include/yaml.h:1829:1: note: expected ‘int (*)(void *, unsigned char *, size_t)’ but argument is of type ‘int (*)(void *, char *, int)’
    ext/_yaml.c: In function ‘__pyx_f_5_yaml_8CEmitter__object_to_event’:
    ext/_yaml.c:12199:44: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
    ext/_yaml.c:12300:44: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
    ext/_yaml.c:12563:5: warning: pointer targets in passing argument 2 of ‘yaml_alias_event_initialize’ differ in signedness [-Wpointer-sign]
    /usr/include/yaml.h:553:1: note: expected ‘yaml_char_t *’ but argument is of type ‘char *’
    ext/_yaml.c:13168:5: warning: pointer targets in passing argument 2 of ‘yaml_scalar_event_initialize’ differ in signedness [-Wpointer-sign]
    /usr/include/yaml.h:578:1: note: expected ‘yaml_char_t *’ but argument is of type ‘char *’
    ext/_yaml.c:13168:5: warning: pointer targets in passing argument 3 of ‘yaml_scalar_event_initialize’ differ in signedness [-Wpointer-sign]
    /usr/include/yaml.h:578:1: note: expected ‘yaml_char_t *’ but argument is of type ‘char *’
    ext/_yaml.c:13168:5: warning: pointer targets in passing argument 4 of ‘yaml_scalar_event_initialize’ differ in signedness [-Wpointer-sign]
    /usr/include/yaml.h:578:1: note: expected ‘yaml_char_t *’ but argument is of type ‘char *’
    ext/_yaml.c:13521:5: warning: pointer targets in passing argument 2 of ‘yaml_sequence_start_event_initialize’ differ in signedness [-Wpointer-sign]
    /usr/include/yaml.h:601:1: note: expected ‘yaml_char_t *’ but argument is of type ‘char *’
    ext/_yaml.c:13521:5: warning: pointer targets in passing argument 3 of ‘yaml_sequence_start_event_initialize’ differ in signedness [-Wpointer-sign]
    /usr/include/yaml.h:601:1: note: expected ‘yaml_char_t *’ but argument is of type ‘char *’
    ext/_yaml.c:13874:5: warning: pointer targets in passing argument 2 of ‘yaml_mapping_start_event_initialize’ differ in signedness [-Wpointer-sign]
    /usr/include/yaml.h:633:1: note: expected ‘yaml_char_t *’ but argument is of type ‘char *’
    ext/_yaml.c:13874:5: warning: pointer targets in passing argument 3 of ‘yaml_mapping_start_event_initialize’ differ in signedness [-Wpointer-sign]
    /usr/include/yaml.h:633:1: note: expected ‘yaml_char_t *’ but argument is of type ‘char *’
    ext/_yaml.c: In function ‘__pyx_pf_5_yaml_8CEmitter_6serialize’:
    ext/_yaml.c:15082:42: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
    ext/_yaml.c:15183:42: warning: pointer targets in assignment differ in signedness [-Wpointer-sign]
    ext/_yaml.c: In function ‘__pyx_f_5_yaml_8CEmitter__serialize_node’:
    ext/_yaml.c:15863:5: warning: pointer targets in passing argument 2 of ‘yaml_alias_event_initialize’ differ in signedness [-Wpointer-sign]
    /usr/include/yaml.h:553:1: note: expected ‘yaml_char_t *’ but argument is of type ‘char *’
    ext/_yaml.c:16500:7: warning: pointer targets in passing argument 2 of ‘yaml_scalar_event_initialize’ differ in signedness [-Wpointer-sign]
    /usr/include/yaml.h:578:1: note: expected ‘yaml_char_t *’ but argument is of type ‘char *’
    ext/_yaml.c:16500:7: warning: pointer targets in passing argument 3 of ‘yaml_scalar_event_initialize’ differ in signedness [-Wpointer-sign]
    /usr/include/yaml.h:578:1: note: expected ‘yaml_char_t *’ but argument is of type ‘char *’
    ext/_yaml.c:16500:7: warning: pointer targets in passing argument 4 of ‘yaml_scalar_event_initialize’ differ in signedness [-Wpointer-sign]
    /usr/include/yaml.h:578:1: note: expected ‘yaml_char_t *’ but argument is of type ‘char *’
    ext/_yaml.c:16790:7: warning: pointer targets in passing argument 2 of ‘yaml_sequence_start_event_initialize’ differ in signedness [-Wpointer-sign]
    /usr/include/yaml.h:601:1: note: expected ‘yaml_char_t *’ but argument is of type ‘char *’
    ext/_yaml.c:16790:7: warning: pointer targets in passing argument 3 of ‘yaml_sequence_start_event_initialize’ differ in signedness [-Wpointer-sign]
    /usr/include/yaml.h:601:1: note: expected ‘yaml_char_t *’ but argument is of type ‘char *’
    ext/_yaml.c:17193:7: warning: pointer targets in passing argument 2 of ‘yaml_mapping_start_event_initialize’ differ in signedness [-Wpointer-sign]
    /usr/include/yaml.h:633:1: note: expected ‘yaml_char_t *’ but argument is of type ‘char *’
    ext/_yaml.c:17193:7: warning: pointer targets in passing argument 3 of ‘yaml_mapping_start_event_initialize’ differ in signedness [-Wpointer-sign]
    /usr/include/yaml.h:633:1: note: expected ‘yaml_char_t *’ but argument is of type ‘char *’
    gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/ext/_yaml.o -lyaml -o build/lib.linux-x86_64-2.7/_yaml.so

  Running setup.py install for coverage
    building 'coverage.tracer' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c coverage/tracer.c -o build/temp.linux-x86_64-2.7/coverage/tracer.o
    gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/coverage/tracer.o -o build/lib.linux-x86_64-2.7/coverage/tracer.so

    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    Installing coverage2 script to /home/asottile/workspace/pre-commit/py_env/bin
    Installing coverage-2.7 script to /home/asottile/workspace/pre-commit/py_env/bin
    Installing coverage script to /home/asottile/workspace/pre-commit/py_env/bin
  Running setup.py install for ipdb

    Installing ipdb script to /home/asottile/workspace/pre-commit/py_env/bin
  Running setup.py install for mock

    warning: no files found matching '*.png' under directory 'docs'
    warning: no files found matching '*.css' under directory 'docs'
    warning: no files found matching '*.html' under directory 'docs'
    warning: no files found matching '*.js' under directory 'docs'
  Running setup.py install for pyflakes

    Installing pyflakes script to /home/asottile/workspace/pre-commit/py_env/bin
  Running setup.py install for pytest

    Installing py.test script to /home/asottile/workspace/pre-commit/py_env/bin
    Installing py.test-2.7 script to /home/asottile/workspace/pre-commit/py_env/bin
  Running setup.py install for ipython

    Installing ipcontroller script to /home/asottile/workspace/pre-commit/py_env/bin
    Installing iptest script to /home/asottile/workspace/pre-commit/py_env/bin
    Installing ipcluster script to /home/asottile/workspace/pre-commit/py_env/bin
    Installing ipython script to /home/asottile/workspace/pre-commit/py_env/bin
    Installing pycolor script to /home/asottile/workspace/pre-commit/py_env/bin
    Installing iplogger script to /home/asottile/workspace/pre-commit/py_env/bin
    Installing irunner script to /home/asottile/workspace/pre-commit/py_env/bin
    Installing ipengine script to /home/asottile/workspace/pre-commit/py_env/bin
  Running setup.py install for py

Successfully installed pyyaml coverage ipdb mock pyflakes pytest ipython py
Cleaning up...
bash -c 'source py_env/bin/activate && py.test tests -m "not(integration)"'
============================= test session starts ==============================
platform linux2 -- Python 2.7.3 -- py-1.4.20 -- pytest-2.5.2
collected 4 items

tests/git_test.py F...

=================================== FAILURES ===================================
________________________________ test_get_root _________________________________

empty_git_dir = '/tmp/pytest-4/test_get_root0'

    def test_get_root(empty_git_dir):
        assert git.get_root() == empty_git_dir

        foo = local.path('foo')
        foo.mkdir()

        with in_dir(foo):
>           assert git.get_root() == empty_git_dir

/home/asottile/workspace/pre-commit/tests/git_test.py:34: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def get_root():
>       return local['git']['rev-parse', '--show-toplevel']().strip()

/home/asottile/workspace/pre-commit/pre_commit/git.py:7: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = BoundCommand(LocalCommand(<LocalPath /usr/lib/git-core/git>), ['rev-parse', '--show-toplevel'])
args = (), kwargs = {}

    def __call__(self, *args, **kwargs):
        """A shortcut for `run(args)`, returning only the process' stdout"""
>       return self.run(args, **kwargs)[1]

/home/asottile/workspace/pre-commit/py_env/local/lib/python2.7/site-packages/plumbum/commands/base.py:90: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = BoundCommand(LocalCommand(<LocalPath /usr/lib/git-core/git>), ['rev-parse', '--show-toplevel'])
args = (), kwargs = {}, p = <subprocess.Popen object at 0x2cf2f90>

    def run(self, args = (), **kwargs):
        """Runs the given command (equivalent to popen() followed by
            :func:`run_proc <plumbum.commands.run_proc>`). If the exit code of the process does
            not match the expected one, :class:`ProcessExecutionError
            <plumbum.commands.ProcessExecutionError>` is raised.

            :param args: Any arguments to be passed to the process (a tuple)

            :param retcode: The expected return code of this process (defaults to 0).
                            In order to disable exit-code validation, pass ``None``. It may also
                            be a tuple (or any iterable) of expected exit codes.

                            .. note:: this argument must be passed as a keyword argument.

            :param timeout: The maximal amount of time (in seconds) to allow the process to run.
                            ``None`` means no timeout is imposed; otherwise, if the process hasn't
                            terminated after that many seconds, the process will be forcefully
                            terminated an exception will be raised

                            .. note:: this argument must be passed as a keyword argument.

            :param kwargs: Any keyword-arguments to be passed to the ``Popen`` constructor

            :returns: A tuple of (return code, stdout, stderr)
            """
        with self.bgrun(args, **kwargs) as p:
>           return p.run()

/home/asottile/workspace/pre-commit/py_env/local/lib/python2.7/site-packages/plumbum/commands/base.py:213: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def runner():
        if was_run[0]:
            return  # already done
        was_run[0] = True
        try:
>           return run_proc(p, retcode, timeout)

/home/asottile/workspace/pre-commit/py_env/local/lib/python2.7/site-packages/plumbum/commands/base.py:176: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

proc = <subprocess.Popen object at 0x2cf2f90>, retcode = 0, timeout = None

    def run_proc(proc, retcode, timeout = None):
        """Waits for the given process to terminate, with the expected exit code

        :param proc: a running Popen-like object

        :param retcode: the expected return (exit) code of the process. It defaults to 0 (the
                        convention for success). If ``None``, the return code is ignored.
                        It may also be a tuple (or any object that supports ``__contains__``)
                        of expected return codes.

        :param timeout: the number of seconds (a ``float``) to allow the process to run, before
                        forcefully terminating it. If ``None``, not timeout is imposed; otherwise
                        the process is expected to terminate within that timeout value, or it will
                        be killed and :class:`ProcessTimedOut <plumbum.cli.ProcessTimedOut>`
                        will be raised

        :returns: A tuple of (return code, stdout, stderr)
        """
        if timeout is not None:
            _timeout_queue.put((proc, time.time() + timeout))
        stdout, stderr = proc.communicate()
        proc._end_time = time.time()
        if not stdout:
            stdout = six.b("")
        if not stderr:
            stderr = six.b("")
        if getattr(proc, "encoding", None):
            stdout = stdout.decode(proc.encoding, "ignore")
            stderr = stderr.decode(proc.encoding, "ignore")

        if getattr(proc, "_timed_out", False):
            raise ProcessTimedOut("Process did not terminate within %s seconds" % (timeout,),
                getattr(proc, "argv", None))

        if retcode is not None:
            if hasattr(retcode, "__contains__"):
                if proc.returncode not in retcode:
                    raise ProcessExecutionError(getattr(proc, "argv", None), proc.returncode,
                        stdout, stderr)
            elif proc.returncode != retcode:
                raise ProcessExecutionError(getattr(proc, "argv", None), proc.returncode,
>                   stdout, stderr)
E               ProcessExecutionError: Command line: ['/usr/lib/git-core/git', 'rev-parse', '--show-toplevel']
E               Exit code: 128
E               Stderr:  | fatal: Not a git repository: '.git'

/home/asottile/workspace/pre-commit/py_env/local/lib/python2.7/site-packages/plumbum/commands/processes.py:207: ProcessExecutionError
====================== 1 failed, 3 passed in 0.09 seconds ======================
make: *** [_tests] Error 1

Failures / Fixes detected.
Please fix and commit again.
You could also pass --no-verify, but you probably shouldn't.

Here's git status for convenience: 

# On branch herp
nothing to commit (working directory clean)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.