comparison contrib/check-code.py @ 41761:e2472b12c842

contrib: enforce wrapping too-long lines with () instead of \ This is the style I prefer, and an anecdotal exploration of styles recommended in style guides etc. Further, to quote pep8: > The preferred way of wrapping long lines is by using Python's implied > line continuation inside parentheses, brackets and braces. Long lines > can be broken over multiple lines by wrapping expressions in > parentheses. These should be used in preference to using a backslash > for line continuation. So I think this is a virtuous change. Differential Revision: https://phab.mercurial-scm.org/D5995
author Augie Fackler <augie@google.com>
date Sun, 13 Jan 2019 20:27:00 -0500
parents 7d1798ec92a3
children 14e8d042993a
comparison
equal deleted inserted replaced
41760:1eb2fc21da12 41761:e2472b12c842
231 (r"( +)(#([^!][^\n]*\S)?)", repcomment), 231 (r"( +)(#([^!][^\n]*\S)?)", repcomment),
232 ] 232 ]
233 233
234 pypats = [ 234 pypats = [
235 [ 235 [
236 (r'\\$', 'Use () to wrap long lines in Python, not \\'),
236 (r'^\s*def\s*\w+\s*\(.*,\s*\(', 237 (r'^\s*def\s*\w+\s*\(.*,\s*\(',
237 "tuple parameter unpacking not available in Python 3+"), 238 "tuple parameter unpacking not available in Python 3+"),
238 (r'lambda\s*\(.*,.*\)', 239 (r'lambda\s*\(.*,.*\)',
239 "tuple parameter unpacking not available in Python 3+"), 240 "tuple parameter unpacking not available in Python 3+"),
240 (r'(?<!def)\s+(cmp)\(', "cmp is not available in Python 3+"), 241 (r'(?<!def)\s+(cmp)\(', "cmp is not available in Python 3+"),