comparison contrib/check-code.py @ 25212:a39c35e8e559

check-code: reintroduce str.format() ban for 3.x porting In their infinite wisdom, the Python maintainers stripped bytes of its % and format() methods for 3.x. They've now added % back to 3.5, but format() is still missing. Since we don't have any particular need for it, we should keep avoiding it.
author Matt Mackall <mpm@selenic.com>
date Tue, 19 May 2015 08:41:04 -0500
parents 3613819fb05f
children b40071379c5b
comparison
equal deleted inserted replaced
25211:22f4ce49044d 25212:a39c35e8e559
237 # (r'class\s[A-Z][^\(]*\((?!Exception)', 237 # (r'class\s[A-Z][^\(]*\((?!Exception)',
238 # "don't capitalize non-exception classes"), 238 # "don't capitalize non-exception classes"),
239 # (r'in range\(', "use xrange"), 239 # (r'in range\(', "use xrange"),
240 # (r'^\s*print\s+', "avoid using print in core and extensions"), 240 # (r'^\s*print\s+', "avoid using print in core and extensions"),
241 (r'[\x80-\xff]', "non-ASCII character literal"), 241 (r'[\x80-\xff]', "non-ASCII character literal"),
242 (r'("\')\.format\(', "str.format() has no bytes counterpart, use %"),
242 (r'^\s*(%s)\s\s' % '|'.join(keyword.kwlist), 243 (r'^\s*(%s)\s\s' % '|'.join(keyword.kwlist),
243 "gratuitous whitespace after Python keyword"), 244 "gratuitous whitespace after Python keyword"),
244 (r'([\(\[][ \t]\S)|(\S[ \t][\)\]])', "gratuitous whitespace in () or []"), 245 (r'([\(\[][ \t]\S)|(\S[ \t][\)\]])', "gratuitous whitespace in () or []"),
245 # (r'\s\s=', "gratuitous whitespace before ="), 246 # (r'\s\s=', "gratuitous whitespace before ="),
246 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=|%=)\S', 247 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=|%=)\S',