Mercurial > hg
annotate tests/test-contrib-check-code.t @ 31590:78ac8acfc4bd
convert: fix the handling of empty changlist descriptions in P4
Empty changelist descriptions are valid in Perforce. If we encounter one of
them we are currently running into an IndexError. In case of empty commit
messages set the commit message to **empty changelist description**, which
follows Perforce terminology.
author | David Soria Parra <davidsp@fb.com> |
---|---|
date | Wed, 22 Mar 2017 14:12:58 -0500 |
parents | 2a54cf92c773 |
children | ca727147ff9f |
rev | line source |
---|---|
12632
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
1 $ cat > correct.py <<EOF |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
2 > def toto(arg1, arg2): |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
3 > del arg2 |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
4 > return (5 + 6, 9) |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
5 > EOF |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
6 $ cat > wrong.py <<EOF |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
7 > def toto( arg1, arg2): |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
8 > del(arg2) |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
9 > return ( 5+6, 9) |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
10 > EOF |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
11 $ cat > quote.py <<EOF |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
12 > # let's use quote in comments |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
13 > (''' ( 4x5 ) |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
14 > but """\\''' and finally''', |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
15 > """let's fool checkpatch""", '1+2', |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
16 > '"""', 42+1, """and |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
17 > ( 4-1 ) """, "( 1+1 )\" and ") |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
18 > a, '\\\\\\\\', "\\\\\\" x-2", "c-1" |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
19 > EOF |
14763
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
20 $ cat > classstyle.py <<EOF |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
21 > class newstyle_class(object): |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
22 > pass |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
23 > |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
24 > class oldstyle_class: |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
25 > pass |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
26 > |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
27 > class empty(): |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
28 > pass |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
29 > |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
30 > no_class = 1: |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
31 > pass |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
32 > EOF |
12632
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
33 $ check_code="$TESTDIR"/../contrib/check-code.py |
25199
e78447e61624
check-code: entirely drop the 'non-py24.py' file from the test
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
25198
diff
changeset
|
34 $ "$check_code" ./wrong.py ./correct.py ./quote.py ./classstyle.py |
12632
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
35 ./wrong.py:1: |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
36 > def toto( arg1, arg2): |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
37 gratuitous whitespace in () or [] |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
38 ./wrong.py:2: |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
39 > del(arg2) |
13077
6b8d2ee24ce2
coding style: fix yield used as a function
Thomas Arendsen Hein <thomas@jtah.de>
parents:
13026
diff
changeset
|
40 Python keyword is not a function |
12632
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
41 ./wrong.py:3: |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
42 > return ( 5+6, 9) |
15281
aeeb2afcdc25
check-code: support multiline matches like try/except/finally
Matt Mackall <mpm@selenic.com>
parents:
14763
diff
changeset
|
43 gratuitous whitespace in () or [] |
12632
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
44 missing whitespace in expression |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
45 ./quote.py:5: |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
46 > '"""', 42+1, """and |
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
47 missing whitespace in expression |
14763
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
48 ./classstyle.py:4: |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
49 > class oldstyle_class: |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
50 old-style class, use class foo(object) |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
51 ./classstyle.py:7: |
b071cd58af50
check-code: fix class style checking (with tests)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
13077
diff
changeset
|
52 > class empty(): |
25140
317333e0793c
check-code: fix the error message about 'class foo():'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
25077
diff
changeset
|
53 class foo() creates old style object, use class foo(object) |
12632
6c98107f787e
tests: unify test-check-code
Brodie Rao <brodie@bitheap.org>
parents:
11822
diff
changeset
|
54 [1] |
18183
e1caaeb5a2ed
check-code: disallow defunct <> operator
Augie Fackler <raf@durin42.com>
parents:
18180
diff
changeset
|
55 $ cat > python3-compat.py << EOF |
e1caaeb5a2ed
check-code: disallow defunct <> operator
Augie Fackler <raf@durin42.com>
parents:
18180
diff
changeset
|
56 > foo <> bar |
e1caaeb5a2ed
check-code: disallow defunct <> operator
Augie Fackler <raf@durin42.com>
parents:
18180
diff
changeset
|
57 > reduce(lambda a, b: a + b, [1, 2, 3, 4]) |
20688
a61ed1c2d7a7
check-code: disallow use of dict(key=value) construction
Augie Fackler <raf@durin42.com>
parents:
20005
diff
changeset
|
58 > dict(key=value) |
18183
e1caaeb5a2ed
check-code: disallow defunct <> operator
Augie Fackler <raf@durin42.com>
parents:
18180
diff
changeset
|
59 > EOF |
e1caaeb5a2ed
check-code: disallow defunct <> operator
Augie Fackler <raf@durin42.com>
parents:
18180
diff
changeset
|
60 $ "$check_code" python3-compat.py |
e1caaeb5a2ed
check-code: disallow defunct <> operator
Augie Fackler <raf@durin42.com>
parents:
18180
diff
changeset
|
61 python3-compat.py:1: |
e1caaeb5a2ed
check-code: disallow defunct <> operator
Augie Fackler <raf@durin42.com>
parents:
18180
diff
changeset
|
62 > foo <> bar |
e1caaeb5a2ed
check-code: disallow defunct <> operator
Augie Fackler <raf@durin42.com>
parents:
18180
diff
changeset
|
63 <> operator is not available in Python 3+, use != |
e1caaeb5a2ed
check-code: disallow defunct <> operator
Augie Fackler <raf@durin42.com>
parents:
18180
diff
changeset
|
64 python3-compat.py:2: |
e1caaeb5a2ed
check-code: disallow defunct <> operator
Augie Fackler <raf@durin42.com>
parents:
18180
diff
changeset
|
65 > reduce(lambda a, b: a + b, [1, 2, 3, 4]) |
e1caaeb5a2ed
check-code: disallow defunct <> operator
Augie Fackler <raf@durin42.com>
parents:
18180
diff
changeset
|
66 reduce is not available in Python 3+ |
20688
a61ed1c2d7a7
check-code: disallow use of dict(key=value) construction
Augie Fackler <raf@durin42.com>
parents:
20005
diff
changeset
|
67 python3-compat.py:3: |
a61ed1c2d7a7
check-code: disallow use of dict(key=value) construction
Augie Fackler <raf@durin42.com>
parents:
20005
diff
changeset
|
68 > dict(key=value) |
a61ed1c2d7a7
check-code: disallow use of dict(key=value) construction
Augie Fackler <raf@durin42.com>
parents:
20005
diff
changeset
|
69 dict() is different in Py2 and 3 and is slower than {} |
18183
e1caaeb5a2ed
check-code: disallow defunct <> operator
Augie Fackler <raf@durin42.com>
parents:
18180
diff
changeset
|
70 [1] |
13026
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
71 |
28594
d3990da51637
check-code: prevent use of strcpy
Augie Fackler <augie@google.com>
parents:
27367
diff
changeset
|
72 $ cat > foo.c <<EOF |
d3990da51637
check-code: prevent use of strcpy
Augie Fackler <augie@google.com>
parents:
27367
diff
changeset
|
73 > void narf() { |
d3990da51637
check-code: prevent use of strcpy
Augie Fackler <augie@google.com>
parents:
27367
diff
changeset
|
74 > strcpy(foo, bar); |
d3990da51637
check-code: prevent use of strcpy
Augie Fackler <augie@google.com>
parents:
27367
diff
changeset
|
75 > // strcpy_s is okay, but this comment is not |
d3990da51637
check-code: prevent use of strcpy
Augie Fackler <augie@google.com>
parents:
27367
diff
changeset
|
76 > strcpy_s(foo, bar); |
d3990da51637
check-code: prevent use of strcpy
Augie Fackler <augie@google.com>
parents:
27367
diff
changeset
|
77 > } |
d3990da51637
check-code: prevent use of strcpy
Augie Fackler <augie@google.com>
parents:
27367
diff
changeset
|
78 > EOF |
d3990da51637
check-code: prevent use of strcpy
Augie Fackler <augie@google.com>
parents:
27367
diff
changeset
|
79 $ "$check_code" ./foo.c |
d3990da51637
check-code: prevent use of strcpy
Augie Fackler <augie@google.com>
parents:
27367
diff
changeset
|
80 ./foo.c:2: |
d3990da51637
check-code: prevent use of strcpy
Augie Fackler <augie@google.com>
parents:
27367
diff
changeset
|
81 > strcpy(foo, bar); |
d3990da51637
check-code: prevent use of strcpy
Augie Fackler <augie@google.com>
parents:
27367
diff
changeset
|
82 don't use strcpy, use strlcpy or memcpy |
d3990da51637
check-code: prevent use of strcpy
Augie Fackler <augie@google.com>
parents:
27367
diff
changeset
|
83 ./foo.c:3: |
d3990da51637
check-code: prevent use of strcpy
Augie Fackler <augie@google.com>
parents:
27367
diff
changeset
|
84 > // strcpy_s is okay, but this comment is not |
d3990da51637
check-code: prevent use of strcpy
Augie Fackler <augie@google.com>
parents:
27367
diff
changeset
|
85 don't use //-style comments |
d3990da51637
check-code: prevent use of strcpy
Augie Fackler <augie@google.com>
parents:
27367
diff
changeset
|
86 [1] |
d3990da51637
check-code: prevent use of strcpy
Augie Fackler <augie@google.com>
parents:
27367
diff
changeset
|
87 |
13026
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
88 $ cat > is-op.py <<EOF |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
89 > # is-operator comparing number or string literal |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
90 > x = None |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
91 > y = x is 'foo' |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
92 > y = x is "foo" |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
93 > y = x is 5346 |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
94 > y = x is -6 |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
95 > y = x is not 'foo' |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
96 > y = x is not "foo" |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
97 > y = x is not 5346 |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
98 > y = x is not -6 |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
99 > EOF |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
100 |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
101 $ "$check_code" ./is-op.py |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
102 ./is-op.py:3: |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
103 > y = x is 'foo' |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
104 object comparison with literal |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
105 ./is-op.py:4: |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
106 > y = x is "foo" |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
107 object comparison with literal |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
108 ./is-op.py:5: |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
109 > y = x is 5346 |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
110 object comparison with literal |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
111 ./is-op.py:6: |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
112 > y = x is -6 |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
113 object comparison with literal |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
114 ./is-op.py:7: |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
115 > y = x is not 'foo' |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
116 object comparison with literal |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
117 ./is-op.py:8: |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
118 > y = x is not "foo" |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
119 object comparison with literal |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
120 ./is-op.py:9: |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
121 > y = x is not 5346 |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
122 object comparison with literal |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
123 ./is-op.py:10: |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
124 > y = x is not -6 |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
125 object comparison with literal |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
126 [1] |
53391819f195
check-code: catch Python 'is' comparing number or string literals
Adrian Buehlmann <adrian@cadifra.com>
parents:
12632
diff
changeset
|
127 |
18762
a91387a37f05
check-code: do not prepend "warning" to a failure message
Simon Heimberg <simohe@besonet.ch>
parents:
18183
diff
changeset
|
128 $ cat > for-nolineno.py <<EOF |
15502
7917a104a285
check-code: add --nolineno option for hiding line numbers
Mads Kiilerich <mads@kiilerich.com>
parents:
15285
diff
changeset
|
129 > except: |
7917a104a285
check-code: add --nolineno option for hiding line numbers
Mads Kiilerich <mads@kiilerich.com>
parents:
15285
diff
changeset
|
130 > EOF |
18762
a91387a37f05
check-code: do not prepend "warning" to a failure message
Simon Heimberg <simohe@besonet.ch>
parents:
18183
diff
changeset
|
131 $ "$check_code" for-nolineno.py --nolineno |
a91387a37f05
check-code: do not prepend "warning" to a failure message
Simon Heimberg <simohe@besonet.ch>
parents:
18183
diff
changeset
|
132 for-nolineno.py:0: |
15502
7917a104a285
check-code: add --nolineno option for hiding line numbers
Mads Kiilerich <mads@kiilerich.com>
parents:
15285
diff
changeset
|
133 > except: |
18762
a91387a37f05
check-code: do not prepend "warning" to a failure message
Simon Heimberg <simohe@besonet.ch>
parents:
18183
diff
changeset
|
134 naked except clause |
15502
7917a104a285
check-code: add --nolineno option for hiding line numbers
Mads Kiilerich <mads@kiilerich.com>
parents:
15285
diff
changeset
|
135 [1] |
18180
c582a71457e5
check-code: disallow two-argument form of raise
Augie Fackler <raf@durin42.com>
parents:
17620
diff
changeset
|
136 |
19422
d9e86d656017
check-code: automatically preppend "warning: " to all warning messages
Simon Heimberg <simohe@besonet.ch>
parents:
18762
diff
changeset
|
137 $ cat > warning.t <<EOF |
d9e86d656017
check-code: automatically preppend "warning: " to all warning messages
Simon Heimberg <simohe@besonet.ch>
parents:
18762
diff
changeset
|
138 > $ function warnonly { |
d9e86d656017
check-code: automatically preppend "warning: " to all warning messages
Simon Heimberg <simohe@besonet.ch>
parents:
18762
diff
changeset
|
139 > > } |
20005
22154ec6fb8b
check-code: prepend warning prefix only once, but for each warning
Simon Heimberg <simohe@besonet.ch>
parents:
19998
diff
changeset
|
140 > $ diff -N aaa |
22154ec6fb8b
check-code: prepend warning prefix only once, but for each warning
Simon Heimberg <simohe@besonet.ch>
parents:
19998
diff
changeset
|
141 > $ function onwarn {} |
19422
d9e86d656017
check-code: automatically preppend "warning: " to all warning messages
Simon Heimberg <simohe@besonet.ch>
parents:
18762
diff
changeset
|
142 > EOF |
d9e86d656017
check-code: automatically preppend "warning: " to all warning messages
Simon Heimberg <simohe@besonet.ch>
parents:
18762
diff
changeset
|
143 $ "$check_code" warning.t |
d9e86d656017
check-code: automatically preppend "warning: " to all warning messages
Simon Heimberg <simohe@besonet.ch>
parents:
18762
diff
changeset
|
144 $ "$check_code" --warn warning.t |
d9e86d656017
check-code: automatically preppend "warning: " to all warning messages
Simon Heimberg <simohe@besonet.ch>
parents:
18762
diff
changeset
|
145 warning.t:1: |
d9e86d656017
check-code: automatically preppend "warning: " to all warning messages
Simon Heimberg <simohe@besonet.ch>
parents:
18762
diff
changeset
|
146 > $ function warnonly { |
d9e86d656017
check-code: automatically preppend "warning: " to all warning messages
Simon Heimberg <simohe@besonet.ch>
parents:
18762
diff
changeset
|
147 warning: don't use 'function', use old style |
20005
22154ec6fb8b
check-code: prepend warning prefix only once, but for each warning
Simon Heimberg <simohe@besonet.ch>
parents:
19998
diff
changeset
|
148 warning.t:3: |
22154ec6fb8b
check-code: prepend warning prefix only once, but for each warning
Simon Heimberg <simohe@besonet.ch>
parents:
19998
diff
changeset
|
149 > $ diff -N aaa |
22154ec6fb8b
check-code: prepend warning prefix only once, but for each warning
Simon Heimberg <simohe@besonet.ch>
parents:
19998
diff
changeset
|
150 warning: don't use 'diff -N' |
22154ec6fb8b
check-code: prepend warning prefix only once, but for each warning
Simon Heimberg <simohe@besonet.ch>
parents:
19998
diff
changeset
|
151 warning.t:4: |
22154ec6fb8b
check-code: prepend warning prefix only once, but for each warning
Simon Heimberg <simohe@besonet.ch>
parents:
19998
diff
changeset
|
152 > $ function onwarn {} |
22154ec6fb8b
check-code: prepend warning prefix only once, but for each warning
Simon Heimberg <simohe@besonet.ch>
parents:
19998
diff
changeset
|
153 warning: don't use 'function', use old style |
19422
d9e86d656017
check-code: automatically preppend "warning: " to all warning messages
Simon Heimberg <simohe@besonet.ch>
parents:
18762
diff
changeset
|
154 [1] |
18180
c582a71457e5
check-code: disallow two-argument form of raise
Augie Fackler <raf@durin42.com>
parents:
17620
diff
changeset
|
155 $ cat > raise-format.py <<EOF |
c582a71457e5
check-code: disallow two-argument form of raise
Augie Fackler <raf@durin42.com>
parents:
17620
diff
changeset
|
156 > raise SomeException, message |
c582a71457e5
check-code: disallow two-argument form of raise
Augie Fackler <raf@durin42.com>
parents:
17620
diff
changeset
|
157 > # this next line is okay |
c582a71457e5
check-code: disallow two-argument form of raise
Augie Fackler <raf@durin42.com>
parents:
17620
diff
changeset
|
158 > raise SomeException(arg1, arg2) |
c582a71457e5
check-code: disallow two-argument form of raise
Augie Fackler <raf@durin42.com>
parents:
17620
diff
changeset
|
159 > EOF |
19494
3119dc155ac2
check-code: do not abort on an unreadable file, only report this
Simon Heimberg <simohe@besonet.ch>
parents:
19422
diff
changeset
|
160 $ "$check_code" not-existing.py raise-format.py |
3119dc155ac2
check-code: do not abort on an unreadable file, only report this
Simon Heimberg <simohe@besonet.ch>
parents:
19422
diff
changeset
|
161 Skipping*not-existing.py* (glob) |
18180
c582a71457e5
check-code: disallow two-argument form of raise
Augie Fackler <raf@durin42.com>
parents:
17620
diff
changeset
|
162 raise-format.py:1: |
c582a71457e5
check-code: disallow two-argument form of raise
Augie Fackler <raf@durin42.com>
parents:
17620
diff
changeset
|
163 > raise SomeException, message |
c582a71457e5
check-code: disallow two-argument form of raise
Augie Fackler <raf@durin42.com>
parents:
17620
diff
changeset
|
164 don't use old-style two-argument raise, use Exception(message) |
c582a71457e5
check-code: disallow two-argument form of raise
Augie Fackler <raf@durin42.com>
parents:
17620
diff
changeset
|
165 [1] |
19494
3119dc155ac2
check-code: do not abort on an unreadable file, only report this
Simon Heimberg <simohe@besonet.ch>
parents:
19422
diff
changeset
|
166 |
19998
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
167 $ cat > rst.py <<EOF |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
168 > """problematic rst text |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
169 > |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
170 > .. note:: |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
171 > wrong |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
172 > """ |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
173 > |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
174 > ''' |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
175 > |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
176 > .. note:: |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
177 > |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
178 > valid |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
179 > |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
180 > new text |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
181 > |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
182 > .. note:: |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
183 > |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
184 > also valid |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
185 > ''' |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
186 > |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
187 > """mixed |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
188 > |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
189 > .. note:: |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
190 > |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
191 > good |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
192 > |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
193 > .. note:: |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
194 > plus bad |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
195 > """ |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
196 > EOF |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
197 $ $check_code -w rst.py |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
198 rst.py:3: |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
199 > .. note:: |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
200 warning: add two newlines after '.. note::' |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
201 rst.py:26: |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
202 > .. note:: |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
203 warning: add two newlines after '.. note::' |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
204 [1] |
289bbb294e82
check-code: check comment for '.. note::' without two newlines
Simon Heimberg <simohe@besonet.ch>
parents:
19501
diff
changeset
|
205 |
21097
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
206 $ cat > ./map-inside-gettext.py <<EOF |
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
207 > print _("map inside gettext %s" % v) |
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
208 > |
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
209 > print _("concatenating " " by " " space %s" % v) |
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
210 > print _("concatenating " + " by " + " '+' %s" % v) |
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
211 > |
23139
e53f6b72a0e4
spelling: fixes from proofreading of spell checker issues
Mads Kiilerich <madski@unity3d.com>
parents:
21487
diff
changeset
|
212 > print _("mapping operation in different line %s" |
21097
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
213 > % v) |
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
214 > |
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
215 > print _( |
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
216 > "leading spaces inside of '(' %s" % v) |
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
217 > EOF |
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
218 $ "$check_code" ./map-inside-gettext.py |
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
219 ./map-inside-gettext.py:1: |
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
220 > print _("map inside gettext %s" % v) |
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
221 don't use % inside _() |
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
222 ./map-inside-gettext.py:3: |
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
223 > print _("concatenating " " by " " space %s" % v) |
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
224 don't use % inside _() |
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
225 ./map-inside-gettext.py:4: |
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
226 > print _("concatenating " + " by " + " '+' %s" % v) |
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
227 don't use % inside _() |
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
228 ./map-inside-gettext.py:6: |
23139
e53f6b72a0e4
spelling: fixes from proofreading of spell checker issues
Mads Kiilerich <madski@unity3d.com>
parents:
21487
diff
changeset
|
229 > print _("mapping operation in different line %s" |
21097
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
230 don't use % inside _() |
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
231 ./map-inside-gettext.py:9: |
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
232 > print _( |
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
233 don't use % inside _() |
e8ef59b351c3
check-code: detect "% inside _()" when there are leading whitespaces
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20688
diff
changeset
|
234 [1] |
21487
c26464ce0781
check-code: check for consistent usage of the websub filter in hgweb templates
Steven Brown <StevenGBrown@gmail.com>
parents:
21097
diff
changeset
|
235 |
c26464ce0781
check-code: check for consistent usage of the websub filter in hgweb templates
Steven Brown <StevenGBrown@gmail.com>
parents:
21097
diff
changeset
|
236 web templates |
c26464ce0781
check-code: check for consistent usage of the websub filter in hgweb templates
Steven Brown <StevenGBrown@gmail.com>
parents:
21097
diff
changeset
|
237 |
c26464ce0781
check-code: check for consistent usage of the websub filter in hgweb templates
Steven Brown <StevenGBrown@gmail.com>
parents:
21097
diff
changeset
|
238 $ mkdir -p mercurial/templates |
c26464ce0781
check-code: check for consistent usage of the websub filter in hgweb templates
Steven Brown <StevenGBrown@gmail.com>
parents:
21097
diff
changeset
|
239 $ cat > mercurial/templates/example.tmpl <<EOF |
c26464ce0781
check-code: check for consistent usage of the websub filter in hgweb templates
Steven Brown <StevenGBrown@gmail.com>
parents:
21097
diff
changeset
|
240 > {desc} |
c26464ce0781
check-code: check for consistent usage of the websub filter in hgweb templates
Steven Brown <StevenGBrown@gmail.com>
parents:
21097
diff
changeset
|
241 > {desc|escape} |
c26464ce0781
check-code: check for consistent usage of the websub filter in hgweb templates
Steven Brown <StevenGBrown@gmail.com>
parents:
21097
diff
changeset
|
242 > {desc|firstline} |
c26464ce0781
check-code: check for consistent usage of the websub filter in hgweb templates
Steven Brown <StevenGBrown@gmail.com>
parents:
21097
diff
changeset
|
243 > {desc|websub} |
c26464ce0781
check-code: check for consistent usage of the websub filter in hgweb templates
Steven Brown <StevenGBrown@gmail.com>
parents:
21097
diff
changeset
|
244 > EOF |
c26464ce0781
check-code: check for consistent usage of the websub filter in hgweb templates
Steven Brown <StevenGBrown@gmail.com>
parents:
21097
diff
changeset
|
245 |
c26464ce0781
check-code: check for consistent usage of the websub filter in hgweb templates
Steven Brown <StevenGBrown@gmail.com>
parents:
21097
diff
changeset
|
246 $ "$check_code" --warnings mercurial/templates/example.tmpl |
c26464ce0781
check-code: check for consistent usage of the websub filter in hgweb templates
Steven Brown <StevenGBrown@gmail.com>
parents:
21097
diff
changeset
|
247 mercurial/templates/example.tmpl:2: |
c26464ce0781
check-code: check for consistent usage of the websub filter in hgweb templates
Steven Brown <StevenGBrown@gmail.com>
parents:
21097
diff
changeset
|
248 > {desc|escape} |
c26464ce0781
check-code: check for consistent usage of the websub filter in hgweb templates
Steven Brown <StevenGBrown@gmail.com>
parents:
21097
diff
changeset
|
249 warning: follow desc keyword with either firstline or websub |
c26464ce0781
check-code: check for consistent usage of the websub filter in hgweb templates
Steven Brown <StevenGBrown@gmail.com>
parents:
21097
diff
changeset
|
250 [1] |
29276
4dd530df4742
check-code: replace quoted characters correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28594
diff
changeset
|
251 |
4dd530df4742
check-code: replace quoted characters correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28594
diff
changeset
|
252 'string join across lines with no space' detection |
4dd530df4742
check-code: replace quoted characters correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28594
diff
changeset
|
253 |
4dd530df4742
check-code: replace quoted characters correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28594
diff
changeset
|
254 $ cat > stringjoin.py <<EOF |
4dd530df4742
check-code: replace quoted characters correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28594
diff
changeset
|
255 > foo = (' foo' |
4dd530df4742
check-code: replace quoted characters correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28594
diff
changeset
|
256 > 'bar foo.' |
4dd530df4742
check-code: replace quoted characters correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28594
diff
changeset
|
257 > 'bar foo:' |
4dd530df4742
check-code: replace quoted characters correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28594
diff
changeset
|
258 > 'bar foo@' |
29279
438caf194160
check-code: make repquote distinguish more characters for exact detection
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29276
diff
changeset
|
259 > 'bar foo%' |
438caf194160
check-code: make repquote distinguish more characters for exact detection
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29276
diff
changeset
|
260 > 'bar foo*' |
438caf194160
check-code: make repquote distinguish more characters for exact detection
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29276
diff
changeset
|
261 > 'bar foo+' |
438caf194160
check-code: make repquote distinguish more characters for exact detection
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29276
diff
changeset
|
262 > 'bar foo-' |
29276
4dd530df4742
check-code: replace quoted characters correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28594
diff
changeset
|
263 > 'bar') |
4dd530df4742
check-code: replace quoted characters correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28594
diff
changeset
|
264 > EOF |
29397
844f72885fb9
check-code: detect "missing _() in ui message" more exactly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29279
diff
changeset
|
265 |
844f72885fb9
check-code: detect "missing _() in ui message" more exactly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29279
diff
changeset
|
266 'missing _() in ui message' detection |
844f72885fb9
check-code: detect "missing _() in ui message" more exactly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29279
diff
changeset
|
267 |
844f72885fb9
check-code: detect "missing _() in ui message" more exactly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29279
diff
changeset
|
268 $ cat > uigettext.py <<EOF |
844f72885fb9
check-code: detect "missing _() in ui message" more exactly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29279
diff
changeset
|
269 > ui.status("% 10s %05d % -3.2f %*s %%" |
844f72885fb9
check-code: detect "missing _() in ui message" more exactly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29279
diff
changeset
|
270 > # this use '\\\\' instead of '\\', because the latter in |
844f72885fb9
check-code: detect "missing _() in ui message" more exactly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29279
diff
changeset
|
271 > # heredoc on shell becomes just '\' |
844f72885fb9
check-code: detect "missing _() in ui message" more exactly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29279
diff
changeset
|
272 > '\\\\ \n \t \0' |
844f72885fb9
check-code: detect "missing _() in ui message" more exactly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29279
diff
changeset
|
273 > """12345 |
844f72885fb9
check-code: detect "missing _() in ui message" more exactly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29279
diff
changeset
|
274 > """ |
844f72885fb9
check-code: detect "missing _() in ui message" more exactly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29279
diff
changeset
|
275 > '''.:*+-= |
844f72885fb9
check-code: detect "missing _() in ui message" more exactly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29279
diff
changeset
|
276 > ''' "%-6d \n 123456 .:*+-= foobar") |
844f72885fb9
check-code: detect "missing _() in ui message" more exactly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29279
diff
changeset
|
277 > EOF |
844f72885fb9
check-code: detect "missing _() in ui message" more exactly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29279
diff
changeset
|
278 |
29398
2a54cf92c773
check-code: build translation table for repquote in global for efficiency
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29397
diff
changeset
|
279 (Checking multiple invalid files at once examines whether caching |
2a54cf92c773
check-code: build translation table for repquote in global for efficiency
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29397
diff
changeset
|
280 translation table for repquote() works as expected or not. All files |
2a54cf92c773
check-code: build translation table for repquote in global for efficiency
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29397
diff
changeset
|
281 should break rules depending on result of repquote(), in this case) |
2a54cf92c773
check-code: build translation table for repquote in global for efficiency
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29397
diff
changeset
|
282 |
2a54cf92c773
check-code: build translation table for repquote in global for efficiency
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29397
diff
changeset
|
283 $ "$check_code" stringjoin.py uigettext.py |
29276
4dd530df4742
check-code: replace quoted characters correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28594
diff
changeset
|
284 stringjoin.py:1: |
4dd530df4742
check-code: replace quoted characters correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28594
diff
changeset
|
285 > foo = (' foo' |
4dd530df4742
check-code: replace quoted characters correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28594
diff
changeset
|
286 string join across lines with no space |
4dd530df4742
check-code: replace quoted characters correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28594
diff
changeset
|
287 stringjoin.py:2: |
4dd530df4742
check-code: replace quoted characters correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28594
diff
changeset
|
288 > 'bar foo.' |
4dd530df4742
check-code: replace quoted characters correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28594
diff
changeset
|
289 string join across lines with no space |
4dd530df4742
check-code: replace quoted characters correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28594
diff
changeset
|
290 stringjoin.py:3: |
4dd530df4742
check-code: replace quoted characters correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28594
diff
changeset
|
291 > 'bar foo:' |
4dd530df4742
check-code: replace quoted characters correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28594
diff
changeset
|
292 string join across lines with no space |
4dd530df4742
check-code: replace quoted characters correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28594
diff
changeset
|
293 stringjoin.py:4: |
4dd530df4742
check-code: replace quoted characters correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28594
diff
changeset
|
294 > 'bar foo@' |
4dd530df4742
check-code: replace quoted characters correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
28594
diff
changeset
|
295 string join across lines with no space |
29279
438caf194160
check-code: make repquote distinguish more characters for exact detection
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29276
diff
changeset
|
296 stringjoin.py:5: |
438caf194160
check-code: make repquote distinguish more characters for exact detection
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29276
diff
changeset
|
297 > 'bar foo%' |
438caf194160
check-code: make repquote distinguish more characters for exact detection
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29276
diff
changeset
|
298 string join across lines with no space |
438caf194160
check-code: make repquote distinguish more characters for exact detection
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29276
diff
changeset
|
299 stringjoin.py:6: |
438caf194160
check-code: make repquote distinguish more characters for exact detection
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29276
diff
changeset
|
300 > 'bar foo*' |
438caf194160
check-code: make repquote distinguish more characters for exact detection
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29276
diff
changeset
|
301 string join across lines with no space |
438caf194160
check-code: make repquote distinguish more characters for exact detection
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29276
diff
changeset
|
302 stringjoin.py:7: |
438caf194160
check-code: make repquote distinguish more characters for exact detection
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29276
diff
changeset
|
303 > 'bar foo+' |
438caf194160
check-code: make repquote distinguish more characters for exact detection
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29276
diff
changeset
|
304 string join across lines with no space |
438caf194160
check-code: make repquote distinguish more characters for exact detection
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29276
diff
changeset
|
305 stringjoin.py:8: |
438caf194160
check-code: make repquote distinguish more characters for exact detection
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29276
diff
changeset
|
306 > 'bar foo-' |
438caf194160
check-code: make repquote distinguish more characters for exact detection
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29276
diff
changeset
|
307 string join across lines with no space |
29397
844f72885fb9
check-code: detect "missing _() in ui message" more exactly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29279
diff
changeset
|
308 uigettext.py:1: |
844f72885fb9
check-code: detect "missing _() in ui message" more exactly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29279
diff
changeset
|
309 > ui.status("% 10s %05d % -3.2f %*s %%" |
844f72885fb9
check-code: detect "missing _() in ui message" more exactly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29279
diff
changeset
|
310 missing _() in ui message (use () to hide false-positives) |
844f72885fb9
check-code: detect "missing _() in ui message" more exactly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
29279
diff
changeset
|
311 [1] |