Show More
@@ -128,7 +128,9 b' pypats = [' | |||
|
128 | 128 | # (r'\w*[a-z][A-Z]\w*\s*=', "don't use camelcase in identifiers"), |
|
129 | 129 | (r'^\s*(if|while|def|class|except|try)\s[^[]*:\s*[^\]#\s]+', |
|
130 | 130 | "linebreak after :"), |
|
131 | (r'class\s[^(]:', "old-style class, use class foo(object)"), | |
|
131 | (r'class\s[^( ]+:', "old-style class, use class foo(object)"), | |
|
132 | (r'class\s[^( ]+\(\):', | |
|
133 | "class foo() not available in Python 2.4, use class foo(object)"), | |
|
132 | 134 | (r'\b(%s)\(' % '|'.join(keyword.kwlist), |
|
133 | 135 | "Python keyword is not a function"), |
|
134 | 136 | (r',]', "unneeded trailing ',' in list"), |
@@ -27,8 +27,21 b'' | |||
|
27 | 27 | > def any(x): |
|
28 | 28 | > pass |
|
29 | 29 | > EOF |
|
30 | $ cat > classstyle.py <<EOF | |
|
31 | > class newstyle_class(object): | |
|
32 | > pass | |
|
33 | > | |
|
34 | > class oldstyle_class: | |
|
35 | > pass | |
|
36 | > | |
|
37 | > class empty(): | |
|
38 | > pass | |
|
39 | > | |
|
40 | > no_class = 1: | |
|
41 | > pass | |
|
42 | > EOF | |
|
30 | 43 |
$ |
|
31 |
$ |
|
|
44 | $ "$check_code" ./wrong.py ./correct.py ./quote.py ./non-py24.py ./classstyle.py | |
|
32 | 45 |
./wrong.py: |
|
33 | 46 |
|
|
34 | 47 |
|
@@ -51,6 +64,12 b'' | |||
|
51 | 64 | ./non-py24.py:4: |
|
52 | 65 | > y = format(x) |
|
53 | 66 | any/all/format not available in Python 2.4 |
|
67 | ./classstyle.py:4: | |
|
68 | > class oldstyle_class: | |
|
69 | old-style class, use class foo(object) | |
|
70 | ./classstyle.py:7: | |
|
71 | > class empty(): | |
|
72 | class foo() not available in Python 2.4, use class foo(object) | |
|
54 | 73 | [1] |
|
55 | 74 | |
|
56 | 75 | $ cat > is-op.py <<EOF |
General Comments 0
You need to be logged in to leave comments.
Login now