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