##// END OF EJS Templates
tests: solaris sh can not negate exit status with '!'
Mads Kiilerich -
r16485:f48b075f stable
parent child Browse files
Show More
@@ -1,435 +1,436 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 #
2 #
3 # check-code - a style and portability checker for Mercurial
3 # check-code - a style and portability checker for Mercurial
4 #
4 #
5 # Copyright 2010 Matt Mackall <mpm@selenic.com>
5 # Copyright 2010 Matt Mackall <mpm@selenic.com>
6 #
6 #
7 # This software may be used and distributed according to the terms of the
7 # This software may be used and distributed according to the terms of the
8 # GNU General Public License version 2 or any later version.
8 # GNU General Public License version 2 or any later version.
9
9
10 import re, glob, os, sys
10 import re, glob, os, sys
11 import keyword
11 import keyword
12 import optparse
12 import optparse
13
13
14 def repquote(m):
14 def repquote(m):
15 t = re.sub(r"\w", "x", m.group('text'))
15 t = re.sub(r"\w", "x", m.group('text'))
16 t = re.sub(r"[^\s\nx]", "o", t)
16 t = re.sub(r"[^\s\nx]", "o", t)
17 return m.group('quote') + t + m.group('quote')
17 return m.group('quote') + t + m.group('quote')
18
18
19 def reppython(m):
19 def reppython(m):
20 comment = m.group('comment')
20 comment = m.group('comment')
21 if comment:
21 if comment:
22 return "#" * len(comment)
22 return "#" * len(comment)
23 return repquote(m)
23 return repquote(m)
24
24
25 def repcomment(m):
25 def repcomment(m):
26 return m.group(1) + "#" * len(m.group(2))
26 return m.group(1) + "#" * len(m.group(2))
27
27
28 def repccomment(m):
28 def repccomment(m):
29 t = re.sub(r"((?<=\n) )|\S", "x", m.group(2))
29 t = re.sub(r"((?<=\n) )|\S", "x", m.group(2))
30 return m.group(1) + t + "*/"
30 return m.group(1) + t + "*/"
31
31
32 def repcallspaces(m):
32 def repcallspaces(m):
33 t = re.sub(r"\n\s+", "\n", m.group(2))
33 t = re.sub(r"\n\s+", "\n", m.group(2))
34 return m.group(1) + t
34 return m.group(1) + t
35
35
36 def repinclude(m):
36 def repinclude(m):
37 return m.group(1) + "<foo>"
37 return m.group(1) + "<foo>"
38
38
39 def rephere(m):
39 def rephere(m):
40 t = re.sub(r"\S", "x", m.group(2))
40 t = re.sub(r"\S", "x", m.group(2))
41 return m.group(1) + t
41 return m.group(1) + t
42
42
43
43
44 testpats = [
44 testpats = [
45 [
45 [
46 (r'(pushd|popd)', "don't use 'pushd' or 'popd', use 'cd'"),
46 (r'(pushd|popd)', "don't use 'pushd' or 'popd', use 'cd'"),
47 (r'\W\$?\(\([^\)\n]*\)\)', "don't use (()) or $(()), use 'expr'"),
47 (r'\W\$?\(\([^\)\n]*\)\)', "don't use (()) or $(()), use 'expr'"),
48 (r'^function', "don't use 'function', use old style"),
48 (r'^function', "don't use 'function', use old style"),
49 (r'grep.*-q', "don't use 'grep -q', redirect to /dev/null"),
49 (r'grep.*-q', "don't use 'grep -q', redirect to /dev/null"),
50 (r'sed.*-i', "don't use 'sed -i', use a temporary file"),
50 (r'sed.*-i', "don't use 'sed -i', use a temporary file"),
51 (r'echo.*\\n', "don't use 'echo \\n', use printf"),
51 (r'echo.*\\n', "don't use 'echo \\n', use printf"),
52 (r'echo -n', "don't use 'echo -n', use printf"),
52 (r'echo -n', "don't use 'echo -n', use printf"),
53 (r'^diff.*-\w*N', "don't use 'diff -N'"),
53 (r'^diff.*-\w*N', "don't use 'diff -N'"),
54 (r'(^| )wc[^|]*$\n(?!.*\(re\))', "filter wc output"),
54 (r'(^| )wc[^|]*$\n(?!.*\(re\))', "filter wc output"),
55 (r'head -c', "don't use 'head -c', use 'dd'"),
55 (r'head -c', "don't use 'head -c', use 'dd'"),
56 (r'sha1sum', "don't use sha1sum, use $TESTDIR/md5sum.py"),
56 (r'sha1sum', "don't use sha1sum, use $TESTDIR/md5sum.py"),
57 (r'ls.*-\w*R', "don't use 'ls -R', use 'find'"),
57 (r'ls.*-\w*R', "don't use 'ls -R', use 'find'"),
58 (r'printf.*\\\d{1,3}', "don't use 'printf \NNN', use Python"),
58 (r'printf.*\\\d{1,3}', "don't use 'printf \NNN', use Python"),
59 (r'printf.*\\x', "don't use printf \\x, use Python"),
59 (r'printf.*\\x', "don't use printf \\x, use Python"),
60 (r'\$\(.*\)', "don't use $(expr), use `expr`"),
60 (r'\$\(.*\)', "don't use $(expr), use `expr`"),
61 (r'rm -rf \*', "don't use naked rm -rf, target a directory"),
61 (r'rm -rf \*', "don't use naked rm -rf, target a directory"),
62 (r'(^|\|\s*)grep (-\w\s+)*[^|]*[(|]\w',
62 (r'(^|\|\s*)grep (-\w\s+)*[^|]*[(|]\w',
63 "use egrep for extended grep syntax"),
63 "use egrep for extended grep syntax"),
64 (r'/bin/', "don't use explicit paths for tools"),
64 (r'/bin/', "don't use explicit paths for tools"),
65 (r'\$PWD', "don't use $PWD, use `pwd`"),
65 (r'\$PWD', "don't use $PWD, use `pwd`"),
66 (r'[^\n]\Z', "no trailing newline"),
66 (r'[^\n]\Z', "no trailing newline"),
67 (r'export.*=', "don't export and assign at once"),
67 (r'export.*=', "don't export and assign at once"),
68 (r'^([^"\'\n]|("[^"\n]*")|(\'[^\'\n]*\'))*\^', "^ must be quoted"),
68 (r'^([^"\'\n]|("[^"\n]*")|(\'[^\'\n]*\'))*\^', "^ must be quoted"),
69 (r'^source\b', "don't use 'source', use '.'"),
69 (r'^source\b', "don't use 'source', use '.'"),
70 (r'touch -d', "don't use 'touch -d', use 'touch -t' instead"),
70 (r'touch -d', "don't use 'touch -d', use 'touch -t' instead"),
71 (r'ls +[^|\n-]+ +-', "options to 'ls' must come before filenames"),
71 (r'ls +[^|\n-]+ +-', "options to 'ls' must come before filenames"),
72 (r'[^>\n]>\s*\$HGRCPATH', "don't overwrite $HGRCPATH, append to it"),
72 (r'[^>\n]>\s*\$HGRCPATH', "don't overwrite $HGRCPATH, append to it"),
73 (r'^stop\(\)', "don't use 'stop' as a shell function name"),
73 (r'^stop\(\)', "don't use 'stop' as a shell function name"),
74 (r'(\[|\btest\b).*-e ', "don't use 'test -e', use 'test -f'"),
74 (r'(\[|\btest\b).*-e ', "don't use 'test -e', use 'test -f'"),
75 (r'^alias\b.*=', "don't use alias, use a function"),
75 (r'^alias\b.*=', "don't use alias, use a function"),
76 (r'if\s*!', "don't use '!' to negate exit status"),
76 ],
77 ],
77 # warnings
78 # warnings
78 []
79 []
79 ]
80 ]
80
81
81 testfilters = [
82 testfilters = [
82 (r"( *)(#([^\n]*\S)?)", repcomment),
83 (r"( *)(#([^\n]*\S)?)", repcomment),
83 (r"<<(\S+)((.|\n)*?\n\1)", rephere),
84 (r"<<(\S+)((.|\n)*?\n\1)", rephere),
84 ]
85 ]
85
86
86 uprefix = r"^ \$ "
87 uprefix = r"^ \$ "
87 uprefixc = r"^ > "
88 uprefixc = r"^ > "
88 utestpats = [
89 utestpats = [
89 [
90 [
90 (r'^(\S| $ ).*(\S[ \t]+|^[ \t]+)\n', "trailing whitespace on non-output"),
91 (r'^(\S| $ ).*(\S[ \t]+|^[ \t]+)\n', "trailing whitespace on non-output"),
91 (uprefix + r'.*\|\s*sed', "use regex test output patterns instead of sed"),
92 (uprefix + r'.*\|\s*sed', "use regex test output patterns instead of sed"),
92 (uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"),
93 (uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"),
93 (uprefix + r'.*(?<!\[)\$\?', "explicit exit code checks unnecessary"),
94 (uprefix + r'.*(?<!\[)\$\?', "explicit exit code checks unnecessary"),
94 (uprefix + r'.*\|\| echo.*(fail|error)',
95 (uprefix + r'.*\|\| echo.*(fail|error)',
95 "explicit exit code checks unnecessary"),
96 "explicit exit code checks unnecessary"),
96 (uprefix + r'set -e', "don't use set -e"),
97 (uprefix + r'set -e', "don't use set -e"),
97 (uprefixc + r'( *)\t', "don't use tabs to indent"),
98 (uprefixc + r'( *)\t', "don't use tabs to indent"),
98 (uprefixc + r'.*do\s*true;\s*done',
99 (uprefixc + r'.*do\s*true;\s*done',
99 "don't use true as loop body, use sleep 0"),
100 "don't use true as loop body, use sleep 0"),
100 ],
101 ],
101 # warnings
102 # warnings
102 []
103 []
103 ]
104 ]
104
105
105 for i in [0, 1]:
106 for i in [0, 1]:
106 for p, m in testpats[i]:
107 for p, m in testpats[i]:
107 if p.startswith(r'^'):
108 if p.startswith(r'^'):
108 p = uprefix + p[1:]
109 p = uprefix + p[1:]
109 else:
110 else:
110 p = uprefix + ".*" + p
111 p = uprefix + ".*" + p
111 utestpats[i].append((p, m))
112 utestpats[i].append((p, m))
112
113
113 utestfilters = [
114 utestfilters = [
114 (r"( *)(#([^\n]*\S)?)", repcomment),
115 (r"( *)(#([^\n]*\S)?)", repcomment),
115 ]
116 ]
116
117
117 pypats = [
118 pypats = [
118 [
119 [
119 (r'^\s*def\s*\w+\s*\(.*,\s*\(',
120 (r'^\s*def\s*\w+\s*\(.*,\s*\(',
120 "tuple parameter unpacking not available in Python 3+"),
121 "tuple parameter unpacking not available in Python 3+"),
121 (r'lambda\s*\(.*,.*\)',
122 (r'lambda\s*\(.*,.*\)',
122 "tuple parameter unpacking not available in Python 3+"),
123 "tuple parameter unpacking not available in Python 3+"),
123 (r'(?<!def)\s+(cmp)\(', "cmp is not available in Python 3+"),
124 (r'(?<!def)\s+(cmp)\(', "cmp is not available in Python 3+"),
124 (r'\breduce\s*\(.*', "reduce is not available in Python 3+"),
125 (r'\breduce\s*\(.*', "reduce is not available in Python 3+"),
125 (r'\.has_key\b', "dict.has_key is not available in Python 3+"),
126 (r'\.has_key\b', "dict.has_key is not available in Python 3+"),
126 (r'^\s*\t', "don't use tabs"),
127 (r'^\s*\t', "don't use tabs"),
127 (r'\S;\s*\n', "semicolon"),
128 (r'\S;\s*\n', "semicolon"),
128 (r'[^_]_\("[^"]+"\s*%', "don't use % inside _()"),
129 (r'[^_]_\("[^"]+"\s*%', "don't use % inside _()"),
129 (r"[^_]_\('[^']+'\s*%", "don't use % inside _()"),
130 (r"[^_]_\('[^']+'\s*%", "don't use % inside _()"),
130 (r'\w,\w', "missing whitespace after ,"),
131 (r'\w,\w', "missing whitespace after ,"),
131 (r'\w[+/*\-<>]\w', "missing whitespace in expression"),
132 (r'\w[+/*\-<>]\w', "missing whitespace in expression"),
132 (r'^\s+\w+=\w+[^,)\n]$', "missing whitespace in assignment"),
133 (r'^\s+\w+=\w+[^,)\n]$', "missing whitespace in assignment"),
133 (r'(\s+)try:\n((?:\n|\1\s.*\n)+?)\1except.*?:\n'
134 (r'(\s+)try:\n((?:\n|\1\s.*\n)+?)\1except.*?:\n'
134 r'((?:\n|\1\s.*\n)+?)\1finally:', 'no try/except/finally in Py2.4'),
135 r'((?:\n|\1\s.*\n)+?)\1finally:', 'no try/except/finally in Py2.4'),
135 (r'.{85}', "line too long"),
136 (r'.{85}', "line too long"),
136 (r' x+[xo][\'"]\n\s+[\'"]x', 'string join across lines with no space'),
137 (r' x+[xo][\'"]\n\s+[\'"]x', 'string join across lines with no space'),
137 (r'[^\n]\Z', "no trailing newline"),
138 (r'[^\n]\Z', "no trailing newline"),
138 (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"),
139 (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"),
139 # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=', "don't use underbars in identifiers"),
140 # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=', "don't use underbars in identifiers"),
140 (r'^\s+(self\.)?[A-za-z][a-z0-9]+[A-Z]\w* = ',
141 (r'^\s+(self\.)?[A-za-z][a-z0-9]+[A-Z]\w* = ',
141 "don't use camelcase in identifiers"),
142 "don't use camelcase in identifiers"),
142 (r'^\s*(if|while|def|class|except|try)\s[^[\n]*:\s*[^\\n]#\s]+',
143 (r'^\s*(if|while|def|class|except|try)\s[^[\n]*:\s*[^\\n]#\s]+',
143 "linebreak after :"),
144 "linebreak after :"),
144 (r'class\s[^( \n]+:', "old-style class, use class foo(object)"),
145 (r'class\s[^( \n]+:', "old-style class, use class foo(object)"),
145 (r'class\s[^( \n]+\(\):',
146 (r'class\s[^( \n]+\(\):',
146 "class foo() not available in Python 2.4, use class foo(object)"),
147 "class foo() not available in Python 2.4, use class foo(object)"),
147 (r'\b(%s)\(' % '|'.join(keyword.kwlist),
148 (r'\b(%s)\(' % '|'.join(keyword.kwlist),
148 "Python keyword is not a function"),
149 "Python keyword is not a function"),
149 (r',]', "unneeded trailing ',' in list"),
150 (r',]', "unneeded trailing ',' in list"),
150 # (r'class\s[A-Z][^\(]*\((?!Exception)',
151 # (r'class\s[A-Z][^\(]*\((?!Exception)',
151 # "don't capitalize non-exception classes"),
152 # "don't capitalize non-exception classes"),
152 # (r'in range\(', "use xrange"),
153 # (r'in range\(', "use xrange"),
153 # (r'^\s*print\s+', "avoid using print in core and extensions"),
154 # (r'^\s*print\s+', "avoid using print in core and extensions"),
154 (r'[\x80-\xff]', "non-ASCII character literal"),
155 (r'[\x80-\xff]', "non-ASCII character literal"),
155 (r'("\')\.format\(', "str.format() not available in Python 2.4"),
156 (r'("\')\.format\(', "str.format() not available in Python 2.4"),
156 (r'^\s*with\s+', "with not available in Python 2.4"),
157 (r'^\s*with\s+', "with not available in Python 2.4"),
157 (r'\.isdisjoint\(', "set.isdisjoint not available in Python 2.4"),
158 (r'\.isdisjoint\(', "set.isdisjoint not available in Python 2.4"),
158 (r'^\s*except.* as .*:', "except as not available in Python 2.4"),
159 (r'^\s*except.* as .*:', "except as not available in Python 2.4"),
159 (r'^\s*os\.path\.relpath', "relpath not available in Python 2.4"),
160 (r'^\s*os\.path\.relpath', "relpath not available in Python 2.4"),
160 (r'(?<!def)\s+(any|all|format)\(',
161 (r'(?<!def)\s+(any|all|format)\(',
161 "any/all/format not available in Python 2.4"),
162 "any/all/format not available in Python 2.4"),
162 (r'(?<!def)\s+(callable)\(',
163 (r'(?<!def)\s+(callable)\(',
163 "callable not available in Python 3, use getattr(f, '__call__', None)"),
164 "callable not available in Python 3, use getattr(f, '__call__', None)"),
164 (r'if\s.*\selse', "if ... else form not available in Python 2.4"),
165 (r'if\s.*\selse', "if ... else form not available in Python 2.4"),
165 (r'^\s*(%s)\s\s' % '|'.join(keyword.kwlist),
166 (r'^\s*(%s)\s\s' % '|'.join(keyword.kwlist),
166 "gratuitous whitespace after Python keyword"),
167 "gratuitous whitespace after Python keyword"),
167 (r'([\(\[][ \t]\S)|(\S[ \t][\)\]])', "gratuitous whitespace in () or []"),
168 (r'([\(\[][ \t]\S)|(\S[ \t][\)\]])', "gratuitous whitespace in () or []"),
168 # (r'\s\s=', "gratuitous whitespace before ="),
169 # (r'\s\s=', "gratuitous whitespace before ="),
169 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\S',
170 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\S',
170 "missing whitespace around operator"),
171 "missing whitespace around operator"),
171 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\s',
172 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\s',
172 "missing whitespace around operator"),
173 "missing whitespace around operator"),
173 (r'\s(\+=|-=|!=|<>|<=|>=|<<=|>>=)\S',
174 (r'\s(\+=|-=|!=|<>|<=|>=|<<=|>>=)\S',
174 "missing whitespace around operator"),
175 "missing whitespace around operator"),
175 (r'[^^+=*/!<>&| -](\s=|=\s)[^= ]',
176 (r'[^^+=*/!<>&| -](\s=|=\s)[^= ]',
176 "wrong whitespace around ="),
177 "wrong whitespace around ="),
177 (r'raise Exception', "don't raise generic exceptions"),
178 (r'raise Exception', "don't raise generic exceptions"),
178 (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"),
179 (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"),
179 (r' [=!]=\s+(True|False|None)',
180 (r' [=!]=\s+(True|False|None)',
180 "comparison with singleton, use 'is' or 'is not' instead"),
181 "comparison with singleton, use 'is' or 'is not' instead"),
181 (r'^\s*(while|if) [01]:',
182 (r'^\s*(while|if) [01]:',
182 "use True/False for constant Boolean expression"),
183 "use True/False for constant Boolean expression"),
183 (r'(?:(?<!def)\s+|\()hasattr',
184 (r'(?:(?<!def)\s+|\()hasattr',
184 'hasattr(foo, bar) is broken, use util.safehasattr(foo, bar) instead'),
185 'hasattr(foo, bar) is broken, use util.safehasattr(foo, bar) instead'),
185 (r'opener\([^)]*\).read\(',
186 (r'opener\([^)]*\).read\(',
186 "use opener.read() instead"),
187 "use opener.read() instead"),
187 (r'BaseException', 'not in Py2.4, use Exception'),
188 (r'BaseException', 'not in Py2.4, use Exception'),
188 (r'os\.path\.relpath', 'os.path.relpath is not in Py2.5'),
189 (r'os\.path\.relpath', 'os.path.relpath is not in Py2.5'),
189 (r'opener\([^)]*\).write\(',
190 (r'opener\([^)]*\).write\(',
190 "use opener.write() instead"),
191 "use opener.write() instead"),
191 (r'[\s\(](open|file)\([^)]*\)\.read\(',
192 (r'[\s\(](open|file)\([^)]*\)\.read\(',
192 "use util.readfile() instead"),
193 "use util.readfile() instead"),
193 (r'[\s\(](open|file)\([^)]*\)\.write\(',
194 (r'[\s\(](open|file)\([^)]*\)\.write\(',
194 "use util.readfile() instead"),
195 "use util.readfile() instead"),
195 (r'^[\s\(]*(open(er)?|file)\([^)]*\)',
196 (r'^[\s\(]*(open(er)?|file)\([^)]*\)',
196 "always assign an opened file to a variable, and close it afterwards"),
197 "always assign an opened file to a variable, and close it afterwards"),
197 (r'[\s\(](open|file)\([^)]*\)\.',
198 (r'[\s\(](open|file)\([^)]*\)\.',
198 "always assign an opened file to a variable, and close it afterwards"),
199 "always assign an opened file to a variable, and close it afterwards"),
199 (r'(?i)descendent', "the proper spelling is descendAnt"),
200 (r'(?i)descendent', "the proper spelling is descendAnt"),
200 (r'\.debug\(\_', "don't mark debug messages for translation"),
201 (r'\.debug\(\_', "don't mark debug messages for translation"),
201 ],
202 ],
202 # warnings
203 # warnings
203 [
204 [
204 (r'.{81}', "warning: line over 80 characters"),
205 (r'.{81}', "warning: line over 80 characters"),
205 (r'^\s*except:$', "warning: naked except clause"),
206 (r'^\s*except:$', "warning: naked except clause"),
206 (r'ui\.(status|progress|write|note|warn)\([\'\"]x',
207 (r'ui\.(status|progress|write|note|warn)\([\'\"]x',
207 "warning: unwrapped ui message"),
208 "warning: unwrapped ui message"),
208 ]
209 ]
209 ]
210 ]
210
211
211 pyfilters = [
212 pyfilters = [
212 (r"""(?msx)(?P<comment>\#.*?$)|
213 (r"""(?msx)(?P<comment>\#.*?$)|
213 ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!")))
214 ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!")))
214 (?P<text>(([^\\]|\\.)*?))
215 (?P<text>(([^\\]|\\.)*?))
215 (?P=quote))""", reppython),
216 (?P=quote))""", reppython),
216 ]
217 ]
217
218
218 cpats = [
219 cpats = [
219 [
220 [
220 (r'//', "don't use //-style comments"),
221 (r'//', "don't use //-style comments"),
221 (r'^ ', "don't use spaces to indent"),
222 (r'^ ', "don't use spaces to indent"),
222 (r'\S\t', "don't use tabs except for indent"),
223 (r'\S\t', "don't use tabs except for indent"),
223 (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"),
224 (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"),
224 (r'.{85}', "line too long"),
225 (r'.{85}', "line too long"),
225 (r'(while|if|do|for)\(', "use space after while/if/do/for"),
226 (r'(while|if|do|for)\(', "use space after while/if/do/for"),
226 (r'return\(', "return is not a function"),
227 (r'return\(', "return is not a function"),
227 (r' ;', "no space before ;"),
228 (r' ;', "no space before ;"),
228 (r'\w+\* \w+', "use int *foo, not int* foo"),
229 (r'\w+\* \w+', "use int *foo, not int* foo"),
229 (r'\([^\)]+\) \w+', "use (int)foo, not (int) foo"),
230 (r'\([^\)]+\) \w+', "use (int)foo, not (int) foo"),
230 (r'\w+ (\+\+|--)', "use foo++, not foo ++"),
231 (r'\w+ (\+\+|--)', "use foo++, not foo ++"),
231 (r'\w,\w', "missing whitespace after ,"),
232 (r'\w,\w', "missing whitespace after ,"),
232 (r'^[^#]\w[+/*]\w', "missing whitespace in expression"),
233 (r'^[^#]\w[+/*]\w', "missing whitespace in expression"),
233 (r'^#\s+\w', "use #foo, not # foo"),
234 (r'^#\s+\w', "use #foo, not # foo"),
234 (r'[^\n]\Z', "no trailing newline"),
235 (r'[^\n]\Z', "no trailing newline"),
235 (r'^\s*#import\b', "use only #include in standard C code"),
236 (r'^\s*#import\b', "use only #include in standard C code"),
236 ],
237 ],
237 # warnings
238 # warnings
238 []
239 []
239 ]
240 ]
240
241
241 cfilters = [
242 cfilters = [
242 (r'(/\*)(((\*(?!/))|[^*])*)\*/', repccomment),
243 (r'(/\*)(((\*(?!/))|[^*])*)\*/', repccomment),
243 (r'''(?P<quote>(?<!")")(?P<text>([^"]|\\")+)"(?!")''', repquote),
244 (r'''(?P<quote>(?<!")")(?P<text>([^"]|\\")+)"(?!")''', repquote),
244 (r'''(#\s*include\s+<)([^>]+)>''', repinclude),
245 (r'''(#\s*include\s+<)([^>]+)>''', repinclude),
245 (r'(\()([^)]+\))', repcallspaces),
246 (r'(\()([^)]+\))', repcallspaces),
246 ]
247 ]
247
248
248 inutilpats = [
249 inutilpats = [
249 [
250 [
250 (r'\bui\.', "don't use ui in util"),
251 (r'\bui\.', "don't use ui in util"),
251 ],
252 ],
252 # warnings
253 # warnings
253 []
254 []
254 ]
255 ]
255
256
256 inrevlogpats = [
257 inrevlogpats = [
257 [
258 [
258 (r'\brepo\.', "don't use repo in revlog"),
259 (r'\brepo\.', "don't use repo in revlog"),
259 ],
260 ],
260 # warnings
261 # warnings
261 []
262 []
262 ]
263 ]
263
264
264 checks = [
265 checks = [
265 ('python', r'.*\.(py|cgi)$', pyfilters, pypats),
266 ('python', r'.*\.(py|cgi)$', pyfilters, pypats),
266 ('test script', r'(.*/)?test-[^.~]*$', testfilters, testpats),
267 ('test script', r'(.*/)?test-[^.~]*$', testfilters, testpats),
267 ('c', r'.*\.c$', cfilters, cpats),
268 ('c', r'.*\.c$', cfilters, cpats),
268 ('unified test', r'.*\.t$', utestfilters, utestpats),
269 ('unified test', r'.*\.t$', utestfilters, utestpats),
269 ('layering violation repo in revlog', r'mercurial/revlog\.py', pyfilters,
270 ('layering violation repo in revlog', r'mercurial/revlog\.py', pyfilters,
270 inrevlogpats),
271 inrevlogpats),
271 ('layering violation ui in util', r'mercurial/util\.py', pyfilters,
272 ('layering violation ui in util', r'mercurial/util\.py', pyfilters,
272 inutilpats),
273 inutilpats),
273 ]
274 ]
274
275
275 class norepeatlogger(object):
276 class norepeatlogger(object):
276 def __init__(self):
277 def __init__(self):
277 self._lastseen = None
278 self._lastseen = None
278
279
279 def log(self, fname, lineno, line, msg, blame):
280 def log(self, fname, lineno, line, msg, blame):
280 """print error related a to given line of a given file.
281 """print error related a to given line of a given file.
281
282
282 The faulty line will also be printed but only once in the case
283 The faulty line will also be printed but only once in the case
283 of multiple errors.
284 of multiple errors.
284
285
285 :fname: filename
286 :fname: filename
286 :lineno: line number
287 :lineno: line number
287 :line: actual content of the line
288 :line: actual content of the line
288 :msg: error message
289 :msg: error message
289 """
290 """
290 msgid = fname, lineno, line
291 msgid = fname, lineno, line
291 if msgid != self._lastseen:
292 if msgid != self._lastseen:
292 if blame:
293 if blame:
293 print "%s:%d (%s):" % (fname, lineno, blame)
294 print "%s:%d (%s):" % (fname, lineno, blame)
294 else:
295 else:
295 print "%s:%d:" % (fname, lineno)
296 print "%s:%d:" % (fname, lineno)
296 print " > %s" % line
297 print " > %s" % line
297 self._lastseen = msgid
298 self._lastseen = msgid
298 print " " + msg
299 print " " + msg
299
300
300 _defaultlogger = norepeatlogger()
301 _defaultlogger = norepeatlogger()
301
302
302 def getblame(f):
303 def getblame(f):
303 lines = []
304 lines = []
304 for l in os.popen('hg annotate -un %s' % f):
305 for l in os.popen('hg annotate -un %s' % f):
305 start, line = l.split(':', 1)
306 start, line = l.split(':', 1)
306 user, rev = start.split()
307 user, rev = start.split()
307 lines.append((line[1:-1], user, rev))
308 lines.append((line[1:-1], user, rev))
308 return lines
309 return lines
309
310
310 def checkfile(f, logfunc=_defaultlogger.log, maxerr=None, warnings=False,
311 def checkfile(f, logfunc=_defaultlogger.log, maxerr=None, warnings=False,
311 blame=False, debug=False, lineno=True):
312 blame=False, debug=False, lineno=True):
312 """checks style and portability of a given file
313 """checks style and portability of a given file
313
314
314 :f: filepath
315 :f: filepath
315 :logfunc: function used to report error
316 :logfunc: function used to report error
316 logfunc(filename, linenumber, linecontent, errormessage)
317 logfunc(filename, linenumber, linecontent, errormessage)
317 :maxerr: number of error to display before arborting.
318 :maxerr: number of error to display before arborting.
318 Set to false (default) to report all errors
319 Set to false (default) to report all errors
319
320
320 return True if no error is found, False otherwise.
321 return True if no error is found, False otherwise.
321 """
322 """
322 blamecache = None
323 blamecache = None
323 result = True
324 result = True
324 for name, match, filters, pats in checks:
325 for name, match, filters, pats in checks:
325 if debug:
326 if debug:
326 print name, f
327 print name, f
327 fc = 0
328 fc = 0
328 if not re.match(match, f):
329 if not re.match(match, f):
329 if debug:
330 if debug:
330 print "Skipping %s for %s it doesn't match %s" % (
331 print "Skipping %s for %s it doesn't match %s" % (
331 name, match, f)
332 name, match, f)
332 continue
333 continue
333 fp = open(f)
334 fp = open(f)
334 pre = post = fp.read()
335 pre = post = fp.read()
335 fp.close()
336 fp.close()
336 if "no-" + "check-code" in pre:
337 if "no-" + "check-code" in pre:
337 if debug:
338 if debug:
338 print "Skipping %s for %s it has no- and check-code" % (
339 print "Skipping %s for %s it has no- and check-code" % (
339 name, f)
340 name, f)
340 break
341 break
341 for p, r in filters:
342 for p, r in filters:
342 post = re.sub(p, r, post)
343 post = re.sub(p, r, post)
343 if warnings:
344 if warnings:
344 pats = pats[0] + pats[1]
345 pats = pats[0] + pats[1]
345 else:
346 else:
346 pats = pats[0]
347 pats = pats[0]
347 # print post # uncomment to show filtered version
348 # print post # uncomment to show filtered version
348
349
349 if debug:
350 if debug:
350 print "Checking %s for %s" % (name, f)
351 print "Checking %s for %s" % (name, f)
351
352
352 prelines = None
353 prelines = None
353 errors = []
354 errors = []
354 for p, msg in pats:
355 for p, msg in pats:
355 # fix-up regexes for multiline searches
356 # fix-up regexes for multiline searches
356 po = p
357 po = p
357 # \s doesn't match \n
358 # \s doesn't match \n
358 p = re.sub(r'(?<!\\)\\s', r'[ \\t]', p)
359 p = re.sub(r'(?<!\\)\\s', r'[ \\t]', p)
359 # [^...] doesn't match newline
360 # [^...] doesn't match newline
360 p = re.sub(r'(?<!\\)\[\^', r'[^\\n', p)
361 p = re.sub(r'(?<!\\)\[\^', r'[^\\n', p)
361
362
362 #print po, '=>', p
363 #print po, '=>', p
363
364
364 pos = 0
365 pos = 0
365 n = 0
366 n = 0
366 for m in re.finditer(p, post, re.MULTILINE):
367 for m in re.finditer(p, post, re.MULTILINE):
367 if prelines is None:
368 if prelines is None:
368 prelines = pre.splitlines()
369 prelines = pre.splitlines()
369 postlines = post.splitlines(True)
370 postlines = post.splitlines(True)
370
371
371 start = m.start()
372 start = m.start()
372 while n < len(postlines):
373 while n < len(postlines):
373 step = len(postlines[n])
374 step = len(postlines[n])
374 if pos + step > start:
375 if pos + step > start:
375 break
376 break
376 pos += step
377 pos += step
377 n += 1
378 n += 1
378 l = prelines[n]
379 l = prelines[n]
379
380
380 if "check-code" + "-ignore" in l:
381 if "check-code" + "-ignore" in l:
381 if debug:
382 if debug:
382 print "Skipping %s for %s:%s (check-code -ignore)" % (
383 print "Skipping %s for %s:%s (check-code -ignore)" % (
383 name, f, n)
384 name, f, n)
384 continue
385 continue
385 bd = ""
386 bd = ""
386 if blame:
387 if blame:
387 bd = 'working directory'
388 bd = 'working directory'
388 if not blamecache:
389 if not blamecache:
389 blamecache = getblame(f)
390 blamecache = getblame(f)
390 if n < len(blamecache):
391 if n < len(blamecache):
391 bl, bu, br = blamecache[n]
392 bl, bu, br = blamecache[n]
392 if bl == l:
393 if bl == l:
393 bd = '%s@%s' % (bu, br)
394 bd = '%s@%s' % (bu, br)
394 errors.append((f, lineno and n + 1, l, msg, bd))
395 errors.append((f, lineno and n + 1, l, msg, bd))
395 result = False
396 result = False
396
397
397 errors.sort()
398 errors.sort()
398 for e in errors:
399 for e in errors:
399 logfunc(*e)
400 logfunc(*e)
400 fc += 1
401 fc += 1
401 if maxerr and fc >= maxerr:
402 if maxerr and fc >= maxerr:
402 print " (too many errors, giving up)"
403 print " (too many errors, giving up)"
403 break
404 break
404
405
405 return result
406 return result
406
407
407 if __name__ == "__main__":
408 if __name__ == "__main__":
408 parser = optparse.OptionParser("%prog [options] [files]")
409 parser = optparse.OptionParser("%prog [options] [files]")
409 parser.add_option("-w", "--warnings", action="store_true",
410 parser.add_option("-w", "--warnings", action="store_true",
410 help="include warning-level checks")
411 help="include warning-level checks")
411 parser.add_option("-p", "--per-file", type="int",
412 parser.add_option("-p", "--per-file", type="int",
412 help="max warnings per file")
413 help="max warnings per file")
413 parser.add_option("-b", "--blame", action="store_true",
414 parser.add_option("-b", "--blame", action="store_true",
414 help="use annotate to generate blame info")
415 help="use annotate to generate blame info")
415 parser.add_option("", "--debug", action="store_true",
416 parser.add_option("", "--debug", action="store_true",
416 help="show debug information")
417 help="show debug information")
417 parser.add_option("", "--nolineno", action="store_false",
418 parser.add_option("", "--nolineno", action="store_false",
418 dest='lineno', help="don't show line numbers")
419 dest='lineno', help="don't show line numbers")
419
420
420 parser.set_defaults(per_file=15, warnings=False, blame=False, debug=False,
421 parser.set_defaults(per_file=15, warnings=False, blame=False, debug=False,
421 lineno=True)
422 lineno=True)
422 (options, args) = parser.parse_args()
423 (options, args) = parser.parse_args()
423
424
424 if len(args) == 0:
425 if len(args) == 0:
425 check = glob.glob("*")
426 check = glob.glob("*")
426 else:
427 else:
427 check = args
428 check = args
428
429
429 ret = 0
430 ret = 0
430 for f in check:
431 for f in check:
431 if not checkfile(f, maxerr=options.per_file, warnings=options.warnings,
432 if not checkfile(f, maxerr=options.per_file, warnings=options.warnings,
432 blame=options.blame, debug=options.debug,
433 blame=options.blame, debug=options.debug,
433 lineno=options.lineno):
434 lineno=options.lineno):
434 ret = 1
435 ret = 1
435 sys.exit(ret)
436 sys.exit(ret)
@@ -1,641 +1,642 b''
1 $ check_code="$TESTDIR"/../contrib/check-code.py
1 $ check_code="$TESTDIR"/../contrib/check-code.py
2 $ cd "$TESTDIR"/..
2 $ cd "$TESTDIR"/..
3 $ if ! hg identify -q > /dev/null; then
3 $ if hg identify -q > /dev/null; then :
4 > else
4 > echo "skipped: not a Mercurial working dir" >&2
5 > echo "skipped: not a Mercurial working dir" >&2
5 > exit 80
6 > exit 80
6 > fi
7 > fi
7 $ hg manifest | xargs "$check_code" || echo 'FAILURE IS NOT AN OPTION!!!'
8 $ hg manifest | xargs "$check_code" || echo 'FAILURE IS NOT AN OPTION!!!'
8
9
9 $ hg manifest | xargs "$check_code" --warnings --nolineno --per-file=0 || true
10 $ hg manifest | xargs "$check_code" --warnings --nolineno --per-file=0 || true
10 contrib/check-code.py:0:
11 contrib/check-code.py:0:
11 > # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=', "don't use underbars in identifiers"),
12 > # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=', "don't use underbars in identifiers"),
12 warning: line over 80 characters
13 warning: line over 80 characters
13 contrib/perf.py:0:
14 contrib/perf.py:0:
14 > except:
15 > except:
15 warning: naked except clause
16 warning: naked except clause
16 contrib/perf.py:0:
17 contrib/perf.py:0:
17 > #timer(lambda: sum(map(len, repo.dirstate.status(m, [], False, False, False))))
18 > #timer(lambda: sum(map(len, repo.dirstate.status(m, [], False, False, False))))
18 warning: line over 80 characters
19 warning: line over 80 characters
19 contrib/perf.py:0:
20 contrib/perf.py:0:
20 > except:
21 > except:
21 warning: naked except clause
22 warning: naked except clause
22 contrib/setup3k.py:0:
23 contrib/setup3k.py:0:
23 > except:
24 > except:
24 warning: naked except clause
25 warning: naked except clause
25 contrib/setup3k.py:0:
26 contrib/setup3k.py:0:
26 > except:
27 > except:
27 warning: naked except clause
28 warning: naked except clause
28 contrib/setup3k.py:0:
29 contrib/setup3k.py:0:
29 > except:
30 > except:
30 warning: naked except clause
31 warning: naked except clause
31 warning: naked except clause
32 warning: naked except clause
32 warning: naked except clause
33 warning: naked except clause
33 contrib/shrink-revlog.py:0:
34 contrib/shrink-revlog.py:0:
34 > except:
35 > except:
35 warning: naked except clause
36 warning: naked except clause
36 doc/gendoc.py:0:
37 doc/gendoc.py:0:
37 > "together with Mercurial. Help for other extensions is available "
38 > "together with Mercurial. Help for other extensions is available "
38 warning: line over 80 characters
39 warning: line over 80 characters
39 hgext/bugzilla.py:0:
40 hgext/bugzilla.py:0:
40 > raise util.Abort(_('cannot find bugzilla user id for %s or %s') %
41 > raise util.Abort(_('cannot find bugzilla user id for %s or %s') %
41 warning: line over 80 characters
42 warning: line over 80 characters
42 hgext/bugzilla.py:0:
43 hgext/bugzilla.py:0:
43 > bzdir = self.ui.config('bugzilla', 'bzdir', '/var/www/html/bugzilla')
44 > bzdir = self.ui.config('bugzilla', 'bzdir', '/var/www/html/bugzilla')
44 warning: line over 80 characters
45 warning: line over 80 characters
45 hgext/convert/__init__.py:0:
46 hgext/convert/__init__.py:0:
46 > ('', 'ancestors', '', _('show current changeset in ancestor branches')),
47 > ('', 'ancestors', '', _('show current changeset in ancestor branches')),
47 warning: line over 80 characters
48 warning: line over 80 characters
48 hgext/convert/bzr.py:0:
49 hgext/convert/bzr.py:0:
49 > except:
50 > except:
50 warning: naked except clause
51 warning: naked except clause
51 hgext/convert/common.py:0:
52 hgext/convert/common.py:0:
52 > except:
53 > except:
53 warning: naked except clause
54 warning: naked except clause
54 hgext/convert/common.py:0:
55 hgext/convert/common.py:0:
55 > except:
56 > except:
56 warning: naked except clause
57 warning: naked except clause
57 warning: naked except clause
58 warning: naked except clause
58 hgext/convert/convcmd.py:0:
59 hgext/convert/convcmd.py:0:
59 > except:
60 > except:
60 warning: naked except clause
61 warning: naked except clause
61 hgext/convert/cvs.py:0:
62 hgext/convert/cvs.py:0:
62 > # /1 :pserver:user@example.com:2401/cvsroot/foo Ah<Z
63 > # /1 :pserver:user@example.com:2401/cvsroot/foo Ah<Z
63 warning: line over 80 characters
64 warning: line over 80 characters
64 hgext/convert/cvsps.py:0:
65 hgext/convert/cvsps.py:0:
65 > assert len(branches) == 1, 'unknown branch: %s' % e.mergepoint
66 > assert len(branches) == 1, 'unknown branch: %s' % e.mergepoint
66 warning: line over 80 characters
67 warning: line over 80 characters
67 hgext/convert/cvsps.py:0:
68 hgext/convert/cvsps.py:0:
68 > ui.write('Ancestors: %s\n' % (','.join(r)))
69 > ui.write('Ancestors: %s\n' % (','.join(r)))
69 warning: unwrapped ui message
70 warning: unwrapped ui message
70 hgext/convert/cvsps.py:0:
71 hgext/convert/cvsps.py:0:
71 > ui.write('Parent: %d\n' % cs.parents[0].id)
72 > ui.write('Parent: %d\n' % cs.parents[0].id)
72 warning: unwrapped ui message
73 warning: unwrapped ui message
73 hgext/convert/cvsps.py:0:
74 hgext/convert/cvsps.py:0:
74 > ui.write('Parents: %s\n' %
75 > ui.write('Parents: %s\n' %
75 warning: unwrapped ui message
76 warning: unwrapped ui message
76 hgext/convert/cvsps.py:0:
77 hgext/convert/cvsps.py:0:
77 > except:
78 > except:
78 warning: naked except clause
79 warning: naked except clause
79 hgext/convert/cvsps.py:0:
80 hgext/convert/cvsps.py:0:
80 > ui.write('Branchpoints: %s \n' % ', '.join(branchpoints))
81 > ui.write('Branchpoints: %s \n' % ', '.join(branchpoints))
81 warning: unwrapped ui message
82 warning: unwrapped ui message
82 hgext/convert/cvsps.py:0:
83 hgext/convert/cvsps.py:0:
83 > ui.write('Author: %s\n' % cs.author)
84 > ui.write('Author: %s\n' % cs.author)
84 warning: unwrapped ui message
85 warning: unwrapped ui message
85 hgext/convert/cvsps.py:0:
86 hgext/convert/cvsps.py:0:
86 > ui.write('Branch: %s\n' % (cs.branch or 'HEAD'))
87 > ui.write('Branch: %s\n' % (cs.branch or 'HEAD'))
87 warning: unwrapped ui message
88 warning: unwrapped ui message
88 hgext/convert/cvsps.py:0:
89 hgext/convert/cvsps.py:0:
89 > ui.write('Date: %s\n' % util.datestr(cs.date,
90 > ui.write('Date: %s\n' % util.datestr(cs.date,
90 warning: unwrapped ui message
91 warning: unwrapped ui message
91 hgext/convert/cvsps.py:0:
92 hgext/convert/cvsps.py:0:
92 > ui.write('Log:\n')
93 > ui.write('Log:\n')
93 warning: unwrapped ui message
94 warning: unwrapped ui message
94 hgext/convert/cvsps.py:0:
95 hgext/convert/cvsps.py:0:
95 > ui.write('Members: \n')
96 > ui.write('Members: \n')
96 warning: unwrapped ui message
97 warning: unwrapped ui message
97 hgext/convert/cvsps.py:0:
98 hgext/convert/cvsps.py:0:
98 > ui.write('PatchSet %d \n' % cs.id)
99 > ui.write('PatchSet %d \n' % cs.id)
99 warning: unwrapped ui message
100 warning: unwrapped ui message
100 hgext/convert/cvsps.py:0:
101 hgext/convert/cvsps.py:0:
101 > ui.write('Tag%s: %s \n' % (['', 's'][len(cs.tags) > 1],
102 > ui.write('Tag%s: %s \n' % (['', 's'][len(cs.tags) > 1],
102 warning: unwrapped ui message
103 warning: unwrapped ui message
103 hgext/convert/git.py:0:
104 hgext/convert/git.py:0:
104 > except:
105 > except:
105 warning: naked except clause
106 warning: naked except clause
106 hgext/convert/git.py:0:
107 hgext/convert/git.py:0:
107 > fh = self.gitopen('git diff-tree --name-only --root -r %s "%s^%s" --'
108 > fh = self.gitopen('git diff-tree --name-only --root -r %s "%s^%s" --'
108 warning: line over 80 characters
109 warning: line over 80 characters
109 hgext/convert/hg.py:0:
110 hgext/convert/hg.py:0:
110 > # detect missing revlogs and abort on errors or populate self.ignored
111 > # detect missing revlogs and abort on errors or populate self.ignored
111 warning: line over 80 characters
112 warning: line over 80 characters
112 hgext/convert/hg.py:0:
113 hgext/convert/hg.py:0:
113 > except:
114 > except:
114 warning: naked except clause
115 warning: naked except clause
115 warning: naked except clause
116 warning: naked except clause
116 hgext/convert/hg.py:0:
117 hgext/convert/hg.py:0:
117 > except:
118 > except:
118 warning: naked except clause
119 warning: naked except clause
119 hgext/convert/monotone.py:0:
120 hgext/convert/monotone.py:0:
120 > except:
121 > except:
121 warning: naked except clause
122 warning: naked except clause
122 hgext/convert/monotone.py:0:
123 hgext/convert/monotone.py:0:
123 > except:
124 > except:
124 warning: naked except clause
125 warning: naked except clause
125 hgext/convert/subversion.py:0:
126 hgext/convert/subversion.py:0:
126 > raise util.Abort(_('svn: branch has no revision %s') % to_revnum)
127 > raise util.Abort(_('svn: branch has no revision %s') % to_revnum)
127 warning: line over 80 characters
128 warning: line over 80 characters
128 hgext/convert/subversion.py:0:
129 hgext/convert/subversion.py:0:
129 > except:
130 > except:
130 warning: naked except clause
131 warning: naked except clause
131 hgext/convert/subversion.py:0:
132 hgext/convert/subversion.py:0:
132 > args = [self.baseurl, relpaths, start, end, limit, discover_changed_paths,
133 > args = [self.baseurl, relpaths, start, end, limit, discover_changed_paths,
133 warning: line over 80 characters
134 warning: line over 80 characters
134 hgext/convert/subversion.py:0:
135 hgext/convert/subversion.py:0:
135 > self.trunkname = self.ui.config('convert', 'svn.trunk', 'trunk').strip('/')
136 > self.trunkname = self.ui.config('convert', 'svn.trunk', 'trunk').strip('/')
136 warning: line over 80 characters
137 warning: line over 80 characters
137 hgext/convert/subversion.py:0:
138 hgext/convert/subversion.py:0:
138 > except:
139 > except:
139 warning: naked except clause
140 warning: naked except clause
140 hgext/convert/subversion.py:0:
141 hgext/convert/subversion.py:0:
141 > def get_log_child(fp, url, paths, start, end, limit=0, discover_changed_paths=True,
142 > def get_log_child(fp, url, paths, start, end, limit=0, discover_changed_paths=True,
142 warning: line over 80 characters
143 warning: line over 80 characters
143 hgext/eol.py:0:
144 hgext/eol.py:0:
144 > if ui.configbool('eol', 'fix-trailing-newline', False) and s and s[-1] != '\n':
145 > if ui.configbool('eol', 'fix-trailing-newline', False) and s and s[-1] != '\n':
145 warning: line over 80 characters
146 warning: line over 80 characters
146 warning: line over 80 characters
147 warning: line over 80 characters
147 hgext/gpg.py:0:
148 hgext/gpg.py:0:
148 > except:
149 > except:
149 warning: naked except clause
150 warning: naked except clause
150 hgext/hgcia.py:0:
151 hgext/hgcia.py:0:
151 > except:
152 > except:
152 warning: naked except clause
153 warning: naked except clause
153 hgext/hgk.py:0:
154 hgext/hgk.py:0:
154 > ui.write("%s%s\n" % (prefix, description.replace('\n', nlprefix).strip()))
155 > ui.write("%s%s\n" % (prefix, description.replace('\n', nlprefix).strip()))
155 warning: line over 80 characters
156 warning: line over 80 characters
156 hgext/hgk.py:0:
157 hgext/hgk.py:0:
157 > ui.write("parent %s\n" % p)
158 > ui.write("parent %s\n" % p)
158 warning: unwrapped ui message
159 warning: unwrapped ui message
159 hgext/hgk.py:0:
160 hgext/hgk.py:0:
160 > ui.write('k=%s\nv=%s\n' % (name, value))
161 > ui.write('k=%s\nv=%s\n' % (name, value))
161 warning: unwrapped ui message
162 warning: unwrapped ui message
162 hgext/hgk.py:0:
163 hgext/hgk.py:0:
163 > ui.write("author %s %s %s\n" % (ctx.user(), int(date[0]), date[1]))
164 > ui.write("author %s %s %s\n" % (ctx.user(), int(date[0]), date[1]))
164 warning: unwrapped ui message
165 warning: unwrapped ui message
165 hgext/hgk.py:0:
166 hgext/hgk.py:0:
166 > ui.write("branch %s\n\n" % ctx.branch())
167 > ui.write("branch %s\n\n" % ctx.branch())
167 warning: unwrapped ui message
168 warning: unwrapped ui message
168 hgext/hgk.py:0:
169 hgext/hgk.py:0:
169 > ui.write("committer %s %s %s\n" % (committer, int(date[0]), date[1]))
170 > ui.write("committer %s %s %s\n" % (committer, int(date[0]), date[1]))
170 warning: unwrapped ui message
171 warning: unwrapped ui message
171 hgext/hgk.py:0:
172 hgext/hgk.py:0:
172 > ui.write("revision %d\n" % ctx.rev())
173 > ui.write("revision %d\n" % ctx.rev())
173 warning: unwrapped ui message
174 warning: unwrapped ui message
174 hgext/hgk.py:0:
175 hgext/hgk.py:0:
175 > ui.write("tree %s\n" % short(ctx.changeset()[0])) # use ctx.node() instead ??
176 > ui.write("tree %s\n" % short(ctx.changeset()[0])) # use ctx.node() instead ??
176 warning: line over 80 characters
177 warning: line over 80 characters
177 warning: unwrapped ui message
178 warning: unwrapped ui message
178 hgext/highlight/__init__.py:0:
179 hgext/highlight/__init__.py:0:
179 > extensions.wrapfunction(webcommands, '_filerevision', filerevision_highlight)
180 > extensions.wrapfunction(webcommands, '_filerevision', filerevision_highlight)
180 warning: line over 80 characters
181 warning: line over 80 characters
181 hgext/highlight/__init__.py:0:
182 hgext/highlight/__init__.py:0:
182 > return ['/* pygments_style = %s */\n\n' % pg_style, fmter.get_style_defs('')]
183 > return ['/* pygments_style = %s */\n\n' % pg_style, fmter.get_style_defs('')]
183 warning: line over 80 characters
184 warning: line over 80 characters
184 hgext/inotify/__init__.py:0:
185 hgext/inotify/__init__.py:0:
185 > if self._inotifyon and not ignored and not subrepos and not self._dirty:
186 > if self._inotifyon and not ignored and not subrepos and not self._dirty:
186 warning: line over 80 characters
187 warning: line over 80 characters
187 hgext/inotify/server.py:0:
188 hgext/inotify/server.py:0:
188 > except:
189 > except:
189 warning: naked except clause
190 warning: naked except clause
190 hgext/inotify/server.py:0:
191 hgext/inotify/server.py:0:
191 > except:
192 > except:
192 warning: naked except clause
193 warning: naked except clause
193 hgext/keyword.py:0:
194 hgext/keyword.py:0:
194 > ui.note("hg ci -m '%s'\n" % msg)
195 > ui.note("hg ci -m '%s'\n" % msg)
195 warning: unwrapped ui message
196 warning: unwrapped ui message
196 hgext/mq.py:0:
197 hgext/mq.py:0:
197 > raise util.Abort(_("cannot push --exact with applied patches"))
198 > raise util.Abort(_("cannot push --exact with applied patches"))
198 warning: line over 80 characters
199 warning: line over 80 characters
199 hgext/mq.py:0:
200 hgext/mq.py:0:
200 > raise util.Abort(_("cannot use --exact and --move together"))
201 > raise util.Abort(_("cannot use --exact and --move together"))
201 warning: line over 80 characters
202 warning: line over 80 characters
202 hgext/mq.py:0:
203 hgext/mq.py:0:
203 > self.ui.warn(_('Tag %s overrides mq patch of the same name\n')
204 > self.ui.warn(_('Tag %s overrides mq patch of the same name\n')
204 warning: line over 80 characters
205 warning: line over 80 characters
205 hgext/mq.py:0:
206 hgext/mq.py:0:
206 > except:
207 > except:
207 warning: naked except clause
208 warning: naked except clause
208 warning: naked except clause
209 warning: naked except clause
209 hgext/mq.py:0:
210 hgext/mq.py:0:
210 > except:
211 > except:
211 warning: naked except clause
212 warning: naked except clause
212 warning: naked except clause
213 warning: naked except clause
213 warning: naked except clause
214 warning: naked except clause
214 warning: naked except clause
215 warning: naked except clause
215 hgext/mq.py:0:
216 hgext/mq.py:0:
216 > raise util.Abort(_('cannot mix -l/--list with options or arguments'))
217 > raise util.Abort(_('cannot mix -l/--list with options or arguments'))
217 warning: line over 80 characters
218 warning: line over 80 characters
218 hgext/mq.py:0:
219 hgext/mq.py:0:
219 > raise util.Abort(_('qfold cannot fold already applied patch %s') % p)
220 > raise util.Abort(_('qfold cannot fold already applied patch %s') % p)
220 warning: line over 80 characters
221 warning: line over 80 characters
221 hgext/mq.py:0:
222 hgext/mq.py:0:
222 > ('', 'move', None, _('reorder patch series and apply only the patch'))],
223 > ('', 'move', None, _('reorder patch series and apply only the patch'))],
223 warning: line over 80 characters
224 warning: line over 80 characters
224 hgext/mq.py:0:
225 hgext/mq.py:0:
225 > ('U', 'noupdate', None, _('do not update the new working directories')),
226 > ('U', 'noupdate', None, _('do not update the new working directories')),
226 warning: line over 80 characters
227 warning: line over 80 characters
227 hgext/mq.py:0:
228 hgext/mq.py:0:
228 > ('e', 'exact', None, _('apply the target patch to its recorded parent')),
229 > ('e', 'exact', None, _('apply the target patch to its recorded parent')),
229 warning: line over 80 characters
230 warning: line over 80 characters
230 hgext/mq.py:0:
231 hgext/mq.py:0:
231 > except:
232 > except:
232 warning: naked except clause
233 warning: naked except clause
233 hgext/mq.py:0:
234 hgext/mq.py:0:
234 > ui.write("mq: %s\n" % ', '.join(m))
235 > ui.write("mq: %s\n" % ', '.join(m))
235 warning: unwrapped ui message
236 warning: unwrapped ui message
236 hgext/mq.py:0:
237 hgext/mq.py:0:
237 > repo.mq.qseries(repo, missing=opts.get('missing'), summary=opts.get('summary'))
238 > repo.mq.qseries(repo, missing=opts.get('missing'), summary=opts.get('summary'))
238 warning: line over 80 characters
239 warning: line over 80 characters
239 hgext/notify.py:0:
240 hgext/notify.py:0:
240 > ui.note(_('notify: suppressing notification for merge %d:%s\n') %
241 > ui.note(_('notify: suppressing notification for merge %d:%s\n') %
241 warning: line over 80 characters
242 warning: line over 80 characters
242 hgext/patchbomb.py:0:
243 hgext/patchbomb.py:0:
243 > binnode, seqno=idx, total=total)
244 > binnode, seqno=idx, total=total)
244 warning: line over 80 characters
245 warning: line over 80 characters
245 hgext/patchbomb.py:0:
246 hgext/patchbomb.py:0:
246 > except:
247 > except:
247 warning: naked except clause
248 warning: naked except clause
248 hgext/patchbomb.py:0:
249 hgext/patchbomb.py:0:
249 > ui.write('Subject: %s\n' % subj)
250 > ui.write('Subject: %s\n' % subj)
250 warning: unwrapped ui message
251 warning: unwrapped ui message
251 hgext/patchbomb.py:0:
252 hgext/patchbomb.py:0:
252 > p = mail.mimetextpatch('\n'.join(patchlines), 'x-patch', opts.get('test'))
253 > p = mail.mimetextpatch('\n'.join(patchlines), 'x-patch', opts.get('test'))
253 warning: line over 80 characters
254 warning: line over 80 characters
254 hgext/patchbomb.py:0:
255 hgext/patchbomb.py:0:
255 > ui.write('From: %s\n' % sender)
256 > ui.write('From: %s\n' % sender)
256 warning: unwrapped ui message
257 warning: unwrapped ui message
257 hgext/record.py:0:
258 hgext/record.py:0:
258 > ignoreblanklines=opts.get('ignore_blank_lines'))
259 > ignoreblanklines=opts.get('ignore_blank_lines'))
259 warning: line over 80 characters
260 warning: line over 80 characters
260 hgext/record.py:0:
261 hgext/record.py:0:
261 > ignorewsamount=opts.get('ignore_space_change'),
262 > ignorewsamount=opts.get('ignore_space_change'),
262 warning: line over 80 characters
263 warning: line over 80 characters
263 hgext/zeroconf/__init__.py:0:
264 hgext/zeroconf/__init__.py:0:
264 > publish(name, desc, path, util.getport(u.config("web", "port", 8000)))
265 > publish(name, desc, path, util.getport(u.config("web", "port", 8000)))
265 warning: line over 80 characters
266 warning: line over 80 characters
266 hgext/zeroconf/__init__.py:0:
267 hgext/zeroconf/__init__.py:0:
267 > except:
268 > except:
268 warning: naked except clause
269 warning: naked except clause
269 warning: naked except clause
270 warning: naked except clause
270 mercurial/bundlerepo.py:0:
271 mercurial/bundlerepo.py:0:
271 > is a bundlerepo for the obtained bundle when the original "other" is remote.
272 > is a bundlerepo for the obtained bundle when the original "other" is remote.
272 warning: line over 80 characters
273 warning: line over 80 characters
273 mercurial/bundlerepo.py:0:
274 mercurial/bundlerepo.py:0:
274 > "local" is a local repo from which to obtain the actual incoming changesets; it
275 > "local" is a local repo from which to obtain the actual incoming changesets; it
275 warning: line over 80 characters
276 warning: line over 80 characters
276 mercurial/bundlerepo.py:0:
277 mercurial/bundlerepo.py:0:
277 > tmp = discovery.findcommonincoming(repo, other, heads=onlyheads, force=force)
278 > tmp = discovery.findcommonincoming(repo, other, heads=onlyheads, force=force)
278 warning: line over 80 characters
279 warning: line over 80 characters
279 mercurial/commands.py:0:
280 mercurial/commands.py:0:
280 > " size " + basehdr + " link p1 p2 nodeid\n")
281 > " size " + basehdr + " link p1 p2 nodeid\n")
281 warning: line over 80 characters
282 warning: line over 80 characters
282 mercurial/commands.py:0:
283 mercurial/commands.py:0:
283 > raise util.Abort('cannot use localheads with old style discovery')
284 > raise util.Abort('cannot use localheads with old style discovery')
284 warning: line over 80 characters
285 warning: line over 80 characters
285 mercurial/commands.py:0:
286 mercurial/commands.py:0:
286 > ui.note('branch %s\n' % data)
287 > ui.note('branch %s\n' % data)
287 warning: unwrapped ui message
288 warning: unwrapped ui message
288 mercurial/commands.py:0:
289 mercurial/commands.py:0:
289 > ui.note('node %s\n' % str(data))
290 > ui.note('node %s\n' % str(data))
290 warning: unwrapped ui message
291 warning: unwrapped ui message
291 mercurial/commands.py:0:
292 mercurial/commands.py:0:
292 > ui.note('tag %s\n' % name)
293 > ui.note('tag %s\n' % name)
293 warning: unwrapped ui message
294 warning: unwrapped ui message
294 mercurial/commands.py:0:
295 mercurial/commands.py:0:
295 > ui.write("unpruned common: %s\n" % " ".join([short(n)
296 > ui.write("unpruned common: %s\n" % " ".join([short(n)
296 warning: unwrapped ui message
297 warning: unwrapped ui message
297 mercurial/commands.py:0:
298 mercurial/commands.py:0:
298 > yield 'n', (r, list(set(p for p in cl.parentrevs(r) if p != -1)))
299 > yield 'n', (r, list(set(p for p in cl.parentrevs(r) if p != -1)))
299 warning: line over 80 characters
300 warning: line over 80 characters
300 mercurial/commands.py:0:
301 mercurial/commands.py:0:
301 > yield 'n', (r, list(set(p for p in rlog.parentrevs(r) if p != -1)))
302 > yield 'n', (r, list(set(p for p in rlog.parentrevs(r) if p != -1)))
302 warning: line over 80 characters
303 warning: line over 80 characters
303 mercurial/commands.py:0:
304 mercurial/commands.py:0:
304 > except:
305 > except:
305 warning: naked except clause
306 warning: naked except clause
306 mercurial/commands.py:0:
307 mercurial/commands.py:0:
307 > ui.status(_("(run 'hg heads .' to see heads, 'hg merge' to merge)\n"))
308 > ui.status(_("(run 'hg heads .' to see heads, 'hg merge' to merge)\n"))
308 warning: line over 80 characters
309 warning: line over 80 characters
309 mercurial/commands.py:0:
310 mercurial/commands.py:0:
310 > ui.write("format: id, p1, p2, cset, delta base, len(delta)\n")
311 > ui.write("format: id, p1, p2, cset, delta base, len(delta)\n")
311 warning: unwrapped ui message
312 warning: unwrapped ui message
312 mercurial/commands.py:0:
313 mercurial/commands.py:0:
313 > ui.write("local is subset\n")
314 > ui.write("local is subset\n")
314 warning: unwrapped ui message
315 warning: unwrapped ui message
315 mercurial/commands.py:0:
316 mercurial/commands.py:0:
316 > ui.write("remote is subset\n")
317 > ui.write("remote is subset\n")
317 warning: unwrapped ui message
318 warning: unwrapped ui message
318 mercurial/commands.py:0:
319 mercurial/commands.py:0:
319 > ui.write(' other : ' + fmt2 % pcfmt(numoprev, numprev))
320 > ui.write(' other : ' + fmt2 % pcfmt(numoprev, numprev))
320 warning: line over 80 characters
321 warning: line over 80 characters
321 mercurial/commands.py:0:
322 mercurial/commands.py:0:
322 > ui.write(' where prev = p1 : ' + fmt2 % pcfmt(nump1prev, numprev))
323 > ui.write(' where prev = p1 : ' + fmt2 % pcfmt(nump1prev, numprev))
323 warning: line over 80 characters
324 warning: line over 80 characters
324 mercurial/commands.py:0:
325 mercurial/commands.py:0:
325 > ui.write(' where prev = p2 : ' + fmt2 % pcfmt(nump2prev, numprev))
326 > ui.write(' where prev = p2 : ' + fmt2 % pcfmt(nump2prev, numprev))
326 warning: line over 80 characters
327 warning: line over 80 characters
327 mercurial/commands.py:0:
328 mercurial/commands.py:0:
328 > ui.write('deltas against other : ' + fmt % pcfmt(numother, numdeltas))
329 > ui.write('deltas against other : ' + fmt % pcfmt(numother, numdeltas))
329 warning: line over 80 characters
330 warning: line over 80 characters
330 warning: unwrapped ui message
331 warning: unwrapped ui message
331 mercurial/commands.py:0:
332 mercurial/commands.py:0:
332 > ui.write('deltas against p1 : ' + fmt % pcfmt(nump1, numdeltas))
333 > ui.write('deltas against p1 : ' + fmt % pcfmt(nump1, numdeltas))
333 warning: unwrapped ui message
334 warning: unwrapped ui message
334 mercurial/commands.py:0:
335 mercurial/commands.py:0:
335 > ui.write('deltas against p2 : ' + fmt % pcfmt(nump2, numdeltas))
336 > ui.write('deltas against p2 : ' + fmt % pcfmt(nump2, numdeltas))
336 warning: unwrapped ui message
337 warning: unwrapped ui message
337 mercurial/commands.py:0:
338 mercurial/commands.py:0:
338 > cmd, ext, mod = extensions.disabledcmd(ui, name, ui.config('ui', 'strict'))
339 > cmd, ext, mod = extensions.disabledcmd(ui, name, ui.config('ui', 'strict'))
339 warning: line over 80 characters
340 warning: line over 80 characters
340 mercurial/commands.py:0:
341 mercurial/commands.py:0:
341 > except:
342 > except:
342 warning: naked except clause
343 warning: naked except clause
343 mercurial/commands.py:0:
344 mercurial/commands.py:0:
344 > revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
345 > revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
345 warning: line over 80 characters
346 warning: line over 80 characters
346 mercurial/commands.py:0:
347 mercurial/commands.py:0:
347 > ui.write("common heads: %s\n" % " ".join([short(n) for n in common]))
348 > ui.write("common heads: %s\n" % " ".join([short(n) for n in common]))
348 warning: unwrapped ui message
349 warning: unwrapped ui message
349 mercurial/commands.py:0:
350 mercurial/commands.py:0:
350 > ui.write("match: %s\n" % m(d[0]))
351 > ui.write("match: %s\n" % m(d[0]))
351 warning: unwrapped ui message
352 warning: unwrapped ui message
352 mercurial/commands.py:0:
353 mercurial/commands.py:0:
353 > ui.write('deltas against prev : ' + fmt % pcfmt(numprev, numdeltas))
354 > ui.write('deltas against prev : ' + fmt % pcfmt(numprev, numdeltas))
354 warning: unwrapped ui message
355 warning: unwrapped ui message
355 mercurial/commands.py:0:
356 mercurial/commands.py:0:
356 > ui.write('path %s\n' % k)
357 > ui.write('path %s\n' % k)
357 warning: unwrapped ui message
358 warning: unwrapped ui message
358 mercurial/commands.py:0:
359 mercurial/commands.py:0:
359 > ui.write('uncompressed data size (min/max/avg) : %d / %d / %d\n'
360 > ui.write('uncompressed data size (min/max/avg) : %d / %d / %d\n'
360 warning: unwrapped ui message
361 warning: unwrapped ui message
361 mercurial/commands.py:0:
362 mercurial/commands.py:0:
362 > Every ID must be a full-length hex node id string. Returns a list of 0s and 1s
363 > Every ID must be a full-length hex node id string. Returns a list of 0s and 1s
363 warning: line over 80 characters
364 warning: line over 80 characters
364 mercurial/commands.py:0:
365 mercurial/commands.py:0:
365 > remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl), opts.get('branch'))
366 > remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl), opts.get('branch'))
366 warning: line over 80 characters
367 warning: line over 80 characters
367 mercurial/commands.py:0:
368 mercurial/commands.py:0:
368 > ui.write("digraph G {\n")
369 > ui.write("digraph G {\n")
369 warning: unwrapped ui message
370 warning: unwrapped ui message
370 mercurial/commands.py:0:
371 mercurial/commands.py:0:
371 > ui.write("internal: %s %s\n" % d)
372 > ui.write("internal: %s %s\n" % d)
372 warning: unwrapped ui message
373 warning: unwrapped ui message
373 mercurial/commands.py:0:
374 mercurial/commands.py:0:
374 > ui.write("standard: %s\n" % util.datestr(d))
375 > ui.write("standard: %s\n" % util.datestr(d))
375 warning: unwrapped ui message
376 warning: unwrapped ui message
376 mercurial/commands.py:0:
377 mercurial/commands.py:0:
377 > ui.write('avg chain length : ' + fmt % avgchainlen)
378 > ui.write('avg chain length : ' + fmt % avgchainlen)
378 warning: unwrapped ui message
379 warning: unwrapped ui message
379 mercurial/commands.py:0:
380 mercurial/commands.py:0:
380 > ui.write('case-sensitive: %s\n' % (util.checkcase('.debugfsinfo')
381 > ui.write('case-sensitive: %s\n' % (util.checkcase('.debugfsinfo')
381 warning: unwrapped ui message
382 warning: unwrapped ui message
382 mercurial/commands.py:0:
383 mercurial/commands.py:0:
383 > ui.write('compression ratio : ' + fmt % compratio)
384 > ui.write('compression ratio : ' + fmt % compratio)
384 warning: unwrapped ui message
385 warning: unwrapped ui message
385 mercurial/commands.py:0:
386 mercurial/commands.py:0:
386 > ui.write('delta size (min/max/avg) : %d / %d / %d\n'
387 > ui.write('delta size (min/max/avg) : %d / %d / %d\n'
387 warning: unwrapped ui message
388 warning: unwrapped ui message
388 mercurial/commands.py:0:
389 mercurial/commands.py:0:
389 > ui.write('exec: %s\n' % (util.checkexec(path) and 'yes' or 'no'))
390 > ui.write('exec: %s\n' % (util.checkexec(path) and 'yes' or 'no'))
390 warning: unwrapped ui message
391 warning: unwrapped ui message
391 mercurial/commands.py:0:
392 mercurial/commands.py:0:
392 > ui.write('flags : %s\n' % ', '.join(flags))
393 > ui.write('flags : %s\n' % ', '.join(flags))
393 warning: unwrapped ui message
394 warning: unwrapped ui message
394 mercurial/commands.py:0:
395 mercurial/commands.py:0:
395 > ui.write('format : %d\n' % format)
396 > ui.write('format : %d\n' % format)
396 warning: unwrapped ui message
397 warning: unwrapped ui message
397 mercurial/commands.py:0:
398 mercurial/commands.py:0:
398 > ui.write('full revision size (min/max/avg) : %d / %d / %d\n'
399 > ui.write('full revision size (min/max/avg) : %d / %d / %d\n'
399 warning: unwrapped ui message
400 warning: unwrapped ui message
400 mercurial/commands.py:0:
401 mercurial/commands.py:0:
401 > ui.write('revision size : ' + fmt2 % totalsize)
402 > ui.write('revision size : ' + fmt2 % totalsize)
402 warning: unwrapped ui message
403 warning: unwrapped ui message
403 mercurial/commands.py:0:
404 mercurial/commands.py:0:
404 > ui.write('revisions : ' + fmt2 % numrevs)
405 > ui.write('revisions : ' + fmt2 % numrevs)
405 warning: unwrapped ui message
406 warning: unwrapped ui message
406 warning: unwrapped ui message
407 warning: unwrapped ui message
407 mercurial/commands.py:0:
408 mercurial/commands.py:0:
408 > ui.write('symlink: %s\n' % (util.checklink(path) and 'yes' or 'no'))
409 > ui.write('symlink: %s\n' % (util.checklink(path) and 'yes' or 'no'))
409 warning: unwrapped ui message
410 warning: unwrapped ui message
410 mercurial/commandserver.py:0:
411 mercurial/commandserver.py:0:
411 > # the ui here is really the repo ui so take its baseui so we don't end up
412 > # the ui here is really the repo ui so take its baseui so we don't end up
412 warning: line over 80 characters
413 warning: line over 80 characters
413 mercurial/context.py:0:
414 mercurial/context.py:0:
414 > return self._manifestdelta[path], self._manifestdelta.flags(path)
415 > return self._manifestdelta[path], self._manifestdelta.flags(path)
415 warning: line over 80 characters
416 warning: line over 80 characters
416 mercurial/dagparser.py:0:
417 mercurial/dagparser.py:0:
417 > raise util.Abort(_("invalid character in dag description: %s...") % s)
418 > raise util.Abort(_("invalid character in dag description: %s...") % s)
418 warning: line over 80 characters
419 warning: line over 80 characters
419 mercurial/dagparser.py:0:
420 mercurial/dagparser.py:0:
420 > >>> dagtext([('n', (0, [-1])), ('C', 'my command line'), ('n', (1, [0]))])
421 > >>> dagtext([('n', (0, [-1])), ('C', 'my command line'), ('n', (1, [0]))])
421 warning: line over 80 characters
422 warning: line over 80 characters
422 mercurial/dirstate.py:0:
423 mercurial/dirstate.py:0:
423 > if not st is None and not getkind(st.st_mode) in (regkind, lnkkind):
424 > if not st is None and not getkind(st.st_mode) in (regkind, lnkkind):
424 warning: line over 80 characters
425 warning: line over 80 characters
425 mercurial/discovery.py:0:
426 mercurial/discovery.py:0:
426 > If onlyheads is given, only nodes ancestral to nodes in onlyheads (inclusive)
427 > If onlyheads is given, only nodes ancestral to nodes in onlyheads (inclusive)
427 warning: line over 80 characters
428 warning: line over 80 characters
428 mercurial/discovery.py:0:
429 mercurial/discovery.py:0:
429 > def findcommonoutgoing(repo, other, onlyheads=None, force=False, commoninc=None):
430 > def findcommonoutgoing(repo, other, onlyheads=None, force=False, commoninc=None):
430 warning: line over 80 characters
431 warning: line over 80 characters
431 mercurial/dispatch.py:0:
432 mercurial/dispatch.py:0:
432 > " (.hg not found)") % os.getcwd())
433 > " (.hg not found)") % os.getcwd())
433 warning: line over 80 characters
434 warning: line over 80 characters
434 mercurial/dispatch.py:0:
435 mercurial/dispatch.py:0:
435 > aliases, entry = cmdutil.findcmd(cmd, cmdtable, lui.config("ui", "strict"))
436 > aliases, entry = cmdutil.findcmd(cmd, cmdtable, lui.config("ui", "strict"))
436 warning: line over 80 characters
437 warning: line over 80 characters
437 mercurial/dispatch.py:0:
438 mercurial/dispatch.py:0:
438 > except:
439 > except:
439 warning: naked except clause
440 warning: naked except clause
440 mercurial/dispatch.py:0:
441 mercurial/dispatch.py:0:
441 > return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d, [], {})
442 > return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d, [], {})
442 warning: line over 80 characters
443 warning: line over 80 characters
443 mercurial/dispatch.py:0:
444 mercurial/dispatch.py:0:
444 > def __init__(self, args, ui=None, repo=None, fin=None, fout=None, ferr=None):
445 > def __init__(self, args, ui=None, repo=None, fin=None, fout=None, ferr=None):
445 warning: line over 80 characters
446 warning: line over 80 characters
446 mercurial/dispatch.py:0:
447 mercurial/dispatch.py:0:
447 > except:
448 > except:
448 warning: naked except clause
449 warning: naked except clause
449 mercurial/hg.py:0:
450 mercurial/hg.py:0:
450 > except:
451 > except:
451 warning: naked except clause
452 warning: naked except clause
452 mercurial/hgweb/hgweb_mod.py:0:
453 mercurial/hgweb/hgweb_mod.py:0:
453 > self.maxshortchanges = int(self.config("web", "maxshortchanges", 60))
454 > self.maxshortchanges = int(self.config("web", "maxshortchanges", 60))
454 warning: line over 80 characters
455 warning: line over 80 characters
455 mercurial/keepalive.py:0:
456 mercurial/keepalive.py:0:
456 > except:
457 > except:
457 warning: naked except clause
458 warning: naked except clause
458 mercurial/keepalive.py:0:
459 mercurial/keepalive.py:0:
459 > except:
460 > except:
460 warning: naked except clause
461 warning: naked except clause
461 mercurial/localrepo.py:0:
462 mercurial/localrepo.py:0:
462 > # we return an integer indicating remote head count change
463 > # we return an integer indicating remote head count change
463 warning: line over 80 characters
464 warning: line over 80 characters
464 mercurial/localrepo.py:0:
465 mercurial/localrepo.py:0:
465 > raise util.Abort(_("empty or missing revlog for %s") % fname)
466 > raise util.Abort(_("empty or missing revlog for %s") % fname)
466 warning: line over 80 characters
467 warning: line over 80 characters
467 warning: line over 80 characters
468 warning: line over 80 characters
468 mercurial/localrepo.py:0:
469 mercurial/localrepo.py:0:
469 > if self._tagscache.tagtypes and name in self._tagscache.tagtypes:
470 > if self._tagscache.tagtypes and name in self._tagscache.tagtypes:
470 warning: line over 80 characters
471 warning: line over 80 characters
471 mercurial/localrepo.py:0:
472 mercurial/localrepo.py:0:
472 > self.hook("precommit", throw=True, parent1=hookp1, parent2=hookp2)
473 > self.hook("precommit", throw=True, parent1=hookp1, parent2=hookp2)
473 warning: line over 80 characters
474 warning: line over 80 characters
474 mercurial/localrepo.py:0:
475 mercurial/localrepo.py:0:
475 > # new requirements = old non-format requirements + new format-related
476 > # new requirements = old non-format requirements + new format-related
476 warning: line over 80 characters
477 warning: line over 80 characters
477 mercurial/localrepo.py:0:
478 mercurial/localrepo.py:0:
478 > except:
479 > except:
479 warning: naked except clause
480 warning: naked except clause
480 mercurial/localrepo.py:0:
481 mercurial/localrepo.py:0:
481 > """return status of files between two nodes or node and working directory
482 > """return status of files between two nodes or node and working directory
482 warning: line over 80 characters
483 warning: line over 80 characters
483 mercurial/localrepo.py:0:
484 mercurial/localrepo.py:0:
484 > '''Returns a tagscache object that contains various tags related caches.'''
485 > '''Returns a tagscache object that contains various tags related caches.'''
485 warning: line over 80 characters
486 warning: line over 80 characters
486 mercurial/manifest.py:0:
487 mercurial/manifest.py:0:
487 > return "".join(struct.pack(">lll", start, end, len(content)) + content
488 > return "".join(struct.pack(">lll", start, end, len(content)) + content
488 warning: line over 80 characters
489 warning: line over 80 characters
489 mercurial/merge.py:0:
490 mercurial/merge.py:0:
490 > subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx), overwrite)
491 > subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx), overwrite)
491 warning: line over 80 characters
492 warning: line over 80 characters
492 mercurial/patch.py:0:
493 mercurial/patch.py:0:
493 > modified, added, removed, copy, getfilectx, opts, losedata, prefix)
494 > modified, added, removed, copy, getfilectx, opts, losedata, prefix)
494 warning: line over 80 characters
495 warning: line over 80 characters
495 mercurial/patch.py:0:
496 mercurial/patch.py:0:
496 > diffhelpers.addlines(lr, self.hunk, self.lena, self.lenb, self.a, self.b)
497 > diffhelpers.addlines(lr, self.hunk, self.lena, self.lenb, self.a, self.b)
497 warning: line over 80 characters
498 warning: line over 80 characters
498 mercurial/patch.py:0:
499 mercurial/patch.py:0:
499 > output.append(_(' %d files changed, %d insertions(+), %d deletions(-)\n')
500 > output.append(_(' %d files changed, %d insertions(+), %d deletions(-)\n')
500 warning: line over 80 characters
501 warning: line over 80 characters
501 mercurial/patch.py:0:
502 mercurial/patch.py:0:
502 > except:
503 > except:
503 warning: naked except clause
504 warning: naked except clause
504 mercurial/pure/base85.py:0:
505 mercurial/pure/base85.py:0:
505 > raise OverflowError('Base85 overflow in hunk starting at byte %d' % i)
506 > raise OverflowError('Base85 overflow in hunk starting at byte %d' % i)
506 warning: line over 80 characters
507 warning: line over 80 characters
507 mercurial/pure/mpatch.py:0:
508 mercurial/pure/mpatch.py:0:
508 > frags.extend(reversed(new)) # what was left at the end
509 > frags.extend(reversed(new)) # what was left at the end
509 warning: line over 80 characters
510 warning: line over 80 characters
510 mercurial/repair.py:0:
511 mercurial/repair.py:0:
511 > except:
512 > except:
512 warning: naked except clause
513 warning: naked except clause
513 mercurial/repair.py:0:
514 mercurial/repair.py:0:
514 > except:
515 > except:
515 warning: naked except clause
516 warning: naked except clause
516 mercurial/revset.py:0:
517 mercurial/revset.py:0:
517 > elif c.isalnum() or c in '._' or ord(c) > 127: # gather up a symbol/keyword
518 > elif c.isalnum() or c in '._' or ord(c) > 127: # gather up a symbol/keyword
518 warning: line over 80 characters
519 warning: line over 80 characters
519 mercurial/revset.py:0:
520 mercurial/revset.py:0:
520 > Changesets that are the Nth ancestor (first parents only) of a changeset in set.
521 > Changesets that are the Nth ancestor (first parents only) of a changeset in set.
521 warning: line over 80 characters
522 warning: line over 80 characters
522 mercurial/scmutil.py:0:
523 mercurial/scmutil.py:0:
523 > raise util.Abort(_("path '%s' is inside nested repo %r") %
524 > raise util.Abort(_("path '%s' is inside nested repo %r") %
524 warning: line over 80 characters
525 warning: line over 80 characters
525 mercurial/scmutil.py:0:
526 mercurial/scmutil.py:0:
526 > "requires features '%s' (upgrade Mercurial)") % "', '".join(missings))
527 > "requires features '%s' (upgrade Mercurial)") % "', '".join(missings))
527 warning: line over 80 characters
528 warning: line over 80 characters
528 mercurial/scmutil.py:0:
529 mercurial/scmutil.py:0:
529 > elif repo.dirstate[abs] != 'r' and (not good or not os.path.lexists(target)
530 > elif repo.dirstate[abs] != 'r' and (not good or not os.path.lexists(target)
530 warning: line over 80 characters
531 warning: line over 80 characters
531 mercurial/setdiscovery.py:0:
532 mercurial/setdiscovery.py:0:
532 > # treat remote heads (and maybe own heads) as a first implicit sample response
533 > # treat remote heads (and maybe own heads) as a first implicit sample response
533 warning: line over 80 characters
534 warning: line over 80 characters
534 mercurial/setdiscovery.py:0:
535 mercurial/setdiscovery.py:0:
535 > undecided = dag.nodeset() # own nodes where I don't know if remote knows them
536 > undecided = dag.nodeset() # own nodes where I don't know if remote knows them
536 warning: line over 80 characters
537 warning: line over 80 characters
537 mercurial/similar.py:0:
538 mercurial/similar.py:0:
538 > repo.ui.progress(_('searching for similar files'), i, total=len(removed))
539 > repo.ui.progress(_('searching for similar files'), i, total=len(removed))
539 warning: line over 80 characters
540 warning: line over 80 characters
540 mercurial/simplemerge.py:0:
541 mercurial/simplemerge.py:0:
541 > for zmatch, zend, amatch, aend, bmatch, bend in self.find_sync_regions():
542 > for zmatch, zend, amatch, aend, bmatch, bend in self.find_sync_regions():
542 warning: line over 80 characters
543 warning: line over 80 characters
543 mercurial/sshrepo.py:0:
544 mercurial/sshrepo.py:0:
544 > self._abort(error.RepoError(_("no suitable response from remote hg")))
545 > self._abort(error.RepoError(_("no suitable response from remote hg")))
545 warning: line over 80 characters
546 warning: line over 80 characters
546 mercurial/sshrepo.py:0:
547 mercurial/sshrepo.py:0:
547 > except:
548 > except:
548 warning: naked except clause
549 warning: naked except clause
549 mercurial/subrepo.py:0:
550 mercurial/subrepo.py:0:
550 > other, self._repo = hg.clone(self._repo._subparent.ui, {}, other,
551 > other, self._repo = hg.clone(self._repo._subparent.ui, {}, other,
551 warning: line over 80 characters
552 warning: line over 80 characters
552 mercurial/subrepo.py:0:
553 mercurial/subrepo.py:0:
553 > msg = (_(' subrepository sources for %s differ (in checked out version)\n'
554 > msg = (_(' subrepository sources for %s differ (in checked out version)\n'
554 warning: line over 80 characters
555 warning: line over 80 characters
555 mercurial/transaction.py:0:
556 mercurial/transaction.py:0:
556 > except:
557 > except:
557 warning: naked except clause
558 warning: naked except clause
558 mercurial/ui.py:0:
559 mercurial/ui.py:0:
559 > traceback.print_exception(exc[0], exc[1], exc[2], file=self.ferr)
560 > traceback.print_exception(exc[0], exc[1], exc[2], file=self.ferr)
560 warning: line over 80 characters
561 warning: line over 80 characters
561 mercurial/url.py:0:
562 mercurial/url.py:0:
562 > conn = httpsconnection(host, port, keyfile, certfile, *args, **kwargs)
563 > conn = httpsconnection(host, port, keyfile, certfile, *args, **kwargs)
563 warning: line over 80 characters
564 warning: line over 80 characters
564 mercurial/util.py:0:
565 mercurial/util.py:0:
565 > except:
566 > except:
566 warning: naked except clause
567 warning: naked except clause
567 mercurial/util.py:0:
568 mercurial/util.py:0:
568 > except:
569 > except:
569 warning: naked except clause
570 warning: naked except clause
570 mercurial/verify.py:0:
571 mercurial/verify.py:0:
571 > except:
572 > except:
572 warning: naked except clause
573 warning: naked except clause
573 mercurial/verify.py:0:
574 mercurial/verify.py:0:
574 > except:
575 > except:
575 warning: naked except clause
576 warning: naked except clause
576 mercurial/wireproto.py:0:
577 mercurial/wireproto.py:0:
577 > # Assuming the future to be filled with the result from the batched request
578 > # Assuming the future to be filled with the result from the batched request
578 warning: line over 80 characters
579 warning: line over 80 characters
579 mercurial/wireproto.py:0:
580 mercurial/wireproto.py:0:
580 > '''remote must support _submitbatch(encbatch) and _submitone(op, encargs)'''
581 > '''remote must support _submitbatch(encbatch) and _submitone(op, encargs)'''
581 warning: line over 80 characters
582 warning: line over 80 characters
582 mercurial/wireproto.py:0:
583 mercurial/wireproto.py:0:
583 > All methods invoked on instances of this class are simply queued and return a
584 > All methods invoked on instances of this class are simply queued and return a
584 warning: line over 80 characters
585 warning: line over 80 characters
585 mercurial/wireproto.py:0:
586 mercurial/wireproto.py:0:
586 > The decorator returns a function which wraps this coroutine as a plain method,
587 > The decorator returns a function which wraps this coroutine as a plain method,
587 warning: line over 80 characters
588 warning: line over 80 characters
588 setup.py:0:
589 setup.py:0:
589 > raise SystemExit("Python headers are required to build Mercurial")
590 > raise SystemExit("Python headers are required to build Mercurial")
590 warning: line over 80 characters
591 warning: line over 80 characters
591 setup.py:0:
592 setup.py:0:
592 > except:
593 > except:
593 warning: naked except clause
594 warning: naked except clause
594 setup.py:0:
595 setup.py:0:
595 > # build_py), it will not find osutil & friends, thinking that those modules are
596 > # build_py), it will not find osutil & friends, thinking that those modules are
596 warning: line over 80 characters
597 warning: line over 80 characters
597 setup.py:0:
598 setup.py:0:
598 > except:
599 > except:
599 warning: naked except clause
600 warning: naked except clause
600 warning: naked except clause
601 warning: naked except clause
601 setup.py:0:
602 setup.py:0:
602 > isironpython = platform.python_implementation().lower().find("ironpython") != -1
603 > isironpython = platform.python_implementation().lower().find("ironpython") != -1
603 warning: line over 80 characters
604 warning: line over 80 characters
604 setup.py:0:
605 setup.py:0:
605 > except:
606 > except:
606 warning: naked except clause
607 warning: naked except clause
607 warning: naked except clause
608 warning: naked except clause
608 warning: naked except clause
609 warning: naked except clause
609 tests/autodiff.py:0:
610 tests/autodiff.py:0:
610 > ui.write('data lost for: %s\n' % fn)
611 > ui.write('data lost for: %s\n' % fn)
611 warning: unwrapped ui message
612 warning: unwrapped ui message
612 tests/run-tests.py:0:
613 tests/run-tests.py:0:
613 > except:
614 > except:
614 warning: naked except clause
615 warning: naked except clause
615 tests/test-commandserver.py:0:
616 tests/test-commandserver.py:0:
616 > 'hooks.pre-identify=python:test-commandserver.hook', 'id'],
617 > 'hooks.pre-identify=python:test-commandserver.hook', 'id'],
617 warning: line over 80 characters
618 warning: line over 80 characters
618 tests/test-commandserver.py:0:
619 tests/test-commandserver.py:0:
619 > # the cached repo local hgrc contains ui.foo=bar, so showconfig should show it
620 > # the cached repo local hgrc contains ui.foo=bar, so showconfig should show it
620 warning: line over 80 characters
621 warning: line over 80 characters
621 tests/test-commandserver.py:0:
622 tests/test-commandserver.py:0:
622 > print '%c, %r' % (ch, re.sub('encoding: [a-zA-Z0-9-]+', 'encoding: ***', data))
623 > print '%c, %r' % (ch, re.sub('encoding: [a-zA-Z0-9-]+', 'encoding: ***', data))
623 warning: line over 80 characters
624 warning: line over 80 characters
624 tests/test-filecache.py:0:
625 tests/test-filecache.py:0:
625 > except:
626 > except:
626 warning: naked except clause
627 warning: naked except clause
627 tests/test-filecache.py:0:
628 tests/test-filecache.py:0:
628 > if subprocess.call(['python', '%s/hghave' % os.environ['TESTDIR'], 'cacheable']):
629 > if subprocess.call(['python', '%s/hghave' % os.environ['TESTDIR'], 'cacheable']):
629 warning: line over 80 characters
630 warning: line over 80 characters
630 tests/test-ui-color.py:0:
631 tests/test-ui-color.py:0:
631 > testui.warn('warning\n')
632 > testui.warn('warning\n')
632 warning: unwrapped ui message
633 warning: unwrapped ui message
633 tests/test-ui-color.py:0:
634 tests/test-ui-color.py:0:
634 > testui.write('buffered\n')
635 > testui.write('buffered\n')
635 warning: unwrapped ui message
636 warning: unwrapped ui message
636 tests/test-walkrepo.py:0:
637 tests/test-walkrepo.py:0:
637 > print "Found %d repositories when I should have found 2" % (len(reposet),)
638 > print "Found %d repositories when I should have found 2" % (len(reposet),)
638 warning: line over 80 characters
639 warning: line over 80 characters
639 tests/test-walkrepo.py:0:
640 tests/test-walkrepo.py:0:
640 > print "Found %d repositories when I should have found 3" % (len(reposet),)
641 > print "Found %d repositories when I should have found 3" % (len(reposet),)
641 warning: line over 80 characters
642 warning: line over 80 characters
General Comments 0
You need to be logged in to leave comments. Login now