flake8: Add flake8-pep3101 plugin.
Checks for old string formatting. https://pypi.python.org/pypi/flake8-pep3101/
This commit is contained in:
parent
a4a8c00e0f
commit
7fa0dc68bf
@ -84,7 +84,7 @@ def dirbrowser_html(path):
|
|||||||
except OSError as e:
|
except OSError as e:
|
||||||
html = jinja.env.get_template('error.html').render(
|
html = jinja.env.get_template('error.html').render(
|
||||||
title="Error while reading directory",
|
title="Error while reading directory",
|
||||||
url='file://%s' % path,
|
url='file://{}'.format(path),
|
||||||
error=str(e),
|
error=str(e),
|
||||||
icon='')
|
icon='')
|
||||||
return html.encode('UTF-8', errors='xmlcharrefreplace')
|
return html.encode('UTF-8', errors='xmlcharrefreplace')
|
||||||
|
@ -49,7 +49,7 @@ attr_chars = string.ascii_letters + string.digits + attr_chars_nonalnum
|
|||||||
|
|
||||||
|
|
||||||
# RFC 5987 gives this alternative construction of the token character class
|
# RFC 5987 gives this alternative construction of the token character class
|
||||||
token_chars = attr_chars + "*'%"
|
token_chars = attr_chars + "*'%" # flake8: disable=S001
|
||||||
|
|
||||||
|
|
||||||
# Definitions from https://tools.ietf.org/html/rfc2616#section-2.2
|
# Definitions from https://tools.ietf.org/html/rfc2616#section-2.2
|
||||||
|
@ -100,7 +100,7 @@ def _get_environment_vars():
|
|||||||
for key, value in os.environ.items():
|
for key, value in os.environ.items():
|
||||||
for m in masks:
|
for m in masks:
|
||||||
if fnmatch.fnmatch(key, m):
|
if fnmatch.fnmatch(key, m):
|
||||||
info.append('%s = %s' % (key, value))
|
info.append('{} = {}'.format(key, value))
|
||||||
return '\n'.join(sorted(info))
|
return '\n'.join(sorted(info))
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,7 +41,8 @@ class ConfigChecker(checkers.BaseChecker):
|
|||||||
__implements__ = interfaces.IAstroidChecker
|
__implements__ = interfaces.IAstroidChecker
|
||||||
name = 'config'
|
name = 'config'
|
||||||
msgs = {
|
msgs = {
|
||||||
'E0000': ('"%s -> %s" is no valid config option.', 'bad-config-call',
|
'E0000': ('"%s -> %s" is no valid config option.', # flake8: disable=S001
|
||||||
|
'bad-config-call',
|
||||||
None),
|
None),
|
||||||
}
|
}
|
||||||
priority = -1
|
priority = -1
|
||||||
|
@ -128,8 +128,8 @@ def report(items):
|
|||||||
for item in sorted(items, key=lambda e: (e.file.lower(), e.lineno)):
|
for item in sorted(items, key=lambda e: (e.file.lower(), e.lineno)):
|
||||||
relpath = os.path.relpath(item.file)
|
relpath = os.path.relpath(item.file)
|
||||||
path = relpath if not relpath.startswith('..') else item.file
|
path = relpath if not relpath.startswith('..') else item.file
|
||||||
output.append("%s:%d: Unused %s '%s'" % (path, item.lineno, item.typ,
|
output.append("{}:{}: Unused {} '{}'".format(path, item.lineno,
|
||||||
item))
|
item.typ, item))
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,7 +72,8 @@ class UsageFormatter(argparse.HelpFormatter):
|
|||||||
result = "'{}'".format(action.metavar)
|
result = "'{}'".format(action.metavar)
|
||||||
elif action.choices is not None:
|
elif action.choices is not None:
|
||||||
choice_strs = [str(choice) for choice in action.choices]
|
choice_strs = [str(choice) for choice in action.choices]
|
||||||
result = '{%s}' % ','.join('*{}*'.format(e) for e in choice_strs)
|
result = ('{' + ','.join('*{}*'.format(e) for e in choice_strs) +
|
||||||
|
'}')
|
||||||
else:
|
else:
|
||||||
result = "'{}'".format(default_metavar)
|
result = "'{}'".format(default_metavar)
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ putty-ignore =
|
|||||||
/# flake8: disable=N803/ : +N803
|
/# flake8: disable=N803/ : +N803
|
||||||
/# flake8: disable=T002/ : +T002
|
/# flake8: disable=T002/ : +T002
|
||||||
/# flake8: disable=F841/ : +F841
|
/# flake8: disable=F841/ : +F841
|
||||||
|
/# flake8: disable=S001/ : +S001
|
||||||
copyright-check = True
|
copyright-check = True
|
||||||
copyright-regexp = # Copyright [\d-]+ .*
|
copyright-regexp = # Copyright [\d-]+ .*
|
||||||
copyright-min-file-size = 110
|
copyright-min-file-size = 110
|
||||||
|
Loading…
Reference in New Issue
Block a user