Mercurial > hg
changeset 19872:681f7b9213a4
check-code: check for spaces around = for named parameters
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Thu, 03 Oct 2013 14:50:47 +0200 |
parents | 6e74632170d3 |
children | b3de50b0c7aa |
files | contrib/check-code.py contrib/hgfixes/fix_bytesmod.py hgext/acl.py hgext/highlight/__init__.py mercurial/commands.py mercurial/hgweb/webcommands.py mercurial/keepalive.py mercurial/match.py mercurial/templatefilters.py tests/filterpyflakes.py tests/test-trusted.py |
diffstat | 11 files changed, 16 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/check-code.py Thu Oct 03 14:50:47 2013 +0200 +++ b/contrib/check-code.py Thu Oct 03 14:50:47 2013 +0200 @@ -226,6 +226,8 @@ "missing whitespace around operator"), (r'[^^+=*/!<>&| %-](\s=|=\s)[^= ]', "wrong whitespace around ="), + (r'\([^()]*( =[^=]|[^<>!=]= )', + "no whitespace around = for named parameters"), (r'raise Exception', "don't raise generic exceptions"), (r'raise [^,(]+, (\([^\)]+\)|[^,\(\)]+)$', "don't use old-style two-argument raise, use Exception(message)"),
--- a/contrib/hgfixes/fix_bytesmod.py Thu Oct 03 14:50:47 2013 +0200 +++ b/contrib/hgfixes/fix_bytesmod.py Thu Oct 03 14:50:47 2013 +0200 @@ -58,6 +58,6 @@ else: args = [formatstr, Comma().clone(), data] - call = Call(Name('bytesformatter', prefix = ' '), args) + call = Call(Name('bytesformatter', prefix=' '), args) return call
--- a/hgext/acl.py Thu Oct 03 14:50:47 2013 +0200 +++ b/hgext/acl.py Thu Oct 03 14:50:47 2013 +0200 @@ -284,8 +284,8 @@ cfg = ui.config('acl', 'config') if cfg: - ui.readconfig(cfg, sections = ['acl.groups', 'acl.allow.branches', - 'acl.deny.branches', 'acl.allow', 'acl.deny']) + ui.readconfig(cfg, sections=['acl.groups', 'acl.allow.branches', + 'acl.deny.branches', 'acl.allow', 'acl.deny']) allowbranches = buildmatch(ui, None, user, 'acl.allow.branches') denybranches = buildmatch(ui, None, user, 'acl.deny.branches')
--- a/hgext/highlight/__init__.py Thu Oct 03 14:50:47 2013 +0200 +++ b/hgext/highlight/__init__.py Thu Oct 03 14:50:47 2013 +0200 @@ -50,7 +50,7 @@ def generate_css(web, req, tmpl): pg_style = web.config('web', 'pygments_style', 'colorful') - fmter = highlight.HtmlFormatter(style = pg_style) + fmter = highlight.HtmlFormatter(style=pg_style) req.respond(common.HTTP_OK, 'text/css') return ['/* pygments_style = %s */\n\n' % pg_style, fmter.get_style_defs('')]
--- a/mercurial/commands.py Thu Oct 03 14:50:47 2013 +0200 +++ b/mercurial/commands.py Thu Oct 03 14:50:47 2013 +0200 @@ -1808,7 +1808,7 @@ [('c', 'changelog', False, _('open changelog')), ('m', 'manifest', False, _('open manifest'))], _('-c|-m|FILE REV')) -def debugdata(ui, repo, file_, rev = None, **opts): +def debugdata(ui, repo, file_, rev=None, **opts): """dump the contents of a data file revision""" if opts.get('changelog') or opts.get('manifest'): file_, rev = None, file_ @@ -1919,7 +1919,7 @@ ui.write("%s\n" % f) @command('debugfsinfo', [], _('[PATH]')) -def debugfsinfo(ui, path = "."): +def debugfsinfo(ui, path="."): """show information detected about current filesystem""" util.writefile('.debugfsinfo', '') ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no')) @@ -1974,7 +1974,7 @@ ('m', 'manifest', False, _('open manifest')), ('f', 'format', 0, _('revlog format'), _('FORMAT'))], _('[-f FORMAT] -c|-m|FILE')) -def debugindex(ui, repo, file_ = None, **opts): +def debugindex(ui, repo, file_=None, **opts): """dump the contents of an index file""" r = cmdutil.openrevlog(repo, 'debugindex', file_, opts) format = opts.get('format', 0) @@ -2355,7 +2355,7 @@ ('m', 'manifest', False, _('open manifest')), ('d', 'dump', False, _('dump index data'))], _('-c|-m|FILE')) -def debugrevlog(ui, repo, file_ = None, **opts): +def debugrevlog(ui, repo, file_=None, **opts): """show data and statistics about a revlog""" r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts)
--- a/mercurial/hgweb/webcommands.py Thu Oct 03 14:50:47 2013 +0200 +++ b/mercurial/hgweb/webcommands.py Thu Oct 03 14:50:47 2013 +0200 @@ -338,7 +338,7 @@ morevars=morevars, lessvars=lessvars, query=query) def shortlog(web, req, tmpl): - return changelog(web, req, tmpl, shortlog = True) + return changelog(web, req, tmpl, shortlog=True) def changeset(web, req, tmpl): ctx = webutil.changectx(web.repo, req)
--- a/mercurial/keepalive.py Thu Oct 03 14:50:47 2013 +0200 +++ b/mercurial/keepalive.py Thu Oct 03 14:50:47 2013 +0200 @@ -499,7 +499,7 @@ data, self._rbuf = self._rbuf[:i], self._rbuf[i:] return data - def readlines(self, sizehint = 0): + def readlines(self, sizehint=0): total = 0 list = [] while True:
--- a/mercurial/match.py Thu Oct 03 14:50:47 2013 +0200 +++ b/mercurial/match.py Thu Oct 03 14:50:47 2013 +0200 @@ -140,7 +140,7 @@ class exact(match): def __init__(self, root, cwd, files): - match.__init__(self, root, cwd, files, exact = True) + match.__init__(self, root, cwd, files, exact=True) class always(match): def __init__(self, root, cwd):
--- a/mercurial/templatefilters.py Thu Oct 03 14:50:47 2013 +0200 +++ b/mercurial/templatefilters.py Thu Oct 03 14:50:47 2013 +0200 @@ -101,7 +101,7 @@ para_re = None space_re = None -def fill(text, width, initindent = '', hangindent = ''): +def fill(text, width, initindent='', hangindent=''): '''fill many paragraphs with optional indentation.''' global para_re, space_re if para_re is None:
--- a/tests/filterpyflakes.py Thu Oct 03 14:50:47 2013 +0200 +++ b/tests/filterpyflakes.py Thu Oct 03 14:50:47 2013 +0200 @@ -46,6 +46,6 @@ continue lines.append((msgtype, line)) -for msgtype, line in sorted(lines, key = makekey): +for msgtype, line in sorted(lines, key=makekey): sys.stdout.write(line) print
--- a/tests/test-trusted.py Thu Oct 03 14:50:47 2013 +0200 +++ b/tests/test-trusted.py Thu Oct 03 14:50:47 2013 +0200 @@ -145,7 +145,7 @@ f.write('[foobar]\n') f.write('baz = quux\n') f.close() -u.readconfig(filename, sections = ['foobar']) +u.readconfig(filename, sections=['foobar']) print u.config('foobar', 'baz') print