jcrocholl/pep8 — pull request #210 by ThiefMaster (2013-06-25 13:13:19+00:00)
Title: pep8 --diff also checks unmodified context

`pep8 --diff` doesn't only check modified code but also context which is a bad thing e.g. when using it in a git pre-commit hook.

Testcase to reproduce it:

**crap.py**
```
import sys

def foo( bar ):
print "hello world"
sys.exit (0)

def bar():
pass

foo()
```

**crap2.py**
```
import sys

def foo( bar ):
print "hello world"
sys.exit (0)

def bar():
print 'this function is not crap!'

foo()
```

**The resulting diff:**
```
--- crap.py 2013-06-25 14:34:36.677941391 +0200
+++ crap2.py 2013-06-25 14:34:39.366941926 +0200
@@ -5,7 +5,7 @@
sys.exit (0)

def bar():
- pass
+ print 'this function is not crap!'

foo()
```

**Output of `diff -u crap.py crap2.py | pep8 --diff`:**
```
./crap2.py:5:13: E211 whitespace before '('
./crap2.py:7:1: E302 expected 2 blank lines, found 1
```