Commit Graph

11 Commits

Author SHA1 Message Date
Augie Fackler
6f81622e24 check-code: disallow defunct <> operator
Added a test for that and one other python3 check in
test-check-code.t.
2013-01-01 13:05:22 -06:00
Augie Fackler
a52590ca42 check-code: disallow two-argument form of raise
Using this old form makes any attempt to port to Python 3 harder, and
the new syntax is supported in 2.4 already.
2013-01-01 12:58:21 -06:00
Thomas Arendsen Hein
23c6bfee41 check-code: catch yield inside try/finally (with tests)
This is not allowed in Python 2.4.
2012-09-19 12:29:12 +02:00
Mads Kiilerich
5e3dc3e383 avoid using abbreviations that look like spelling errors 2012-08-27 23:14:27 +02:00
Mads Kiilerich
ef0024b865 check-code: add --nolineno option for hiding line numbers
This makes the output more stable when it is used as a whitelist.
2011-11-11 01:25:47 +01:00
Thomas Arendsen Hein
ca6afcfc64 test-check-code.t: test matching try/except/finally introduced in d7e08f92afab 2011-10-17 14:27:34 +02:00
Matt Mackall
db1431fe95 check-code: support multiline matches like try/except/finally
- match one pattern at a time against entire file
- find line containing match
- sort matches by line number
2011-10-16 20:26:20 -05:00
Thomas Arendsen Hein
4575d54a81 check-code: fix class style checking (with tests)
- old-style classes were only checked for one-letter class names
- add check for new-style classes with empty parent class, because
  this is not available in Python 2.4
2011-06-29 13:45:51 +02:00
Thomas Arendsen Hein
16ae1c2ebb coding style: fix yield used as a function 2010-12-03 12:22:56 +01:00
Adrian Buehlmann
5e2e71ea82 check-code: catch Python 'is' comparing number or string literals
The Python 'is' operator compares object identity, so it should
definitely not be applied to string or number literals, which Python
implementations are free to represent with a temporary object.

This should catch the following kinds of bogus expressions (examples):

  x is 'foo'     x is not 'foo'
  x is "bar"     x is not "bar"
  x is 42        x is not 42
  x is -36       x is not -36

As originally proposed by Martin Geisler, amended with catching
negative numbers.
2010-11-21 11:52:27 +01:00
Brodie Rao
dfaf44c2e4 tests: unify test-check-code 2010-10-08 16:08:46 -05:00