requirements: Update vulture to 0.9
* Don't flag attributes as unused if they are used as global variables in another module. * Don't consider "True" and "False" variable names. * Abort with error message when invoked on .pyc files. This means we can remove the whitelisted globals in run_vulture.py and the associated xfailing test. We also needed to adjust run_vulture.py slightly as the file attribute got renamed to filename.
This commit is contained in:
parent
cd136b7b33
commit
03fbacd93c
@ -28,5 +28,5 @@ pytest-rerunfailures==2.0.0
|
|||||||
pytest-travis-fold==1.2.0
|
pytest-travis-fold==1.2.0
|
||||||
pytest-xvfb==0.2.0
|
pytest-xvfb==0.2.0
|
||||||
six==1.10.0
|
six==1.10.0
|
||||||
vulture==0.8.1
|
vulture==0.9
|
||||||
Werkzeug==0.11.10
|
Werkzeug==0.11.10
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
# This file is automatically generated by scripts/dev/recompile_requirements.py
|
# This file is automatically generated by scripts/dev/recompile_requirements.py
|
||||||
|
|
||||||
vulture==0.8.1
|
vulture==0.9
|
||||||
|
@ -77,14 +77,6 @@ def whitelist_generator():
|
|||||||
for func in qutescheme.HANDLERS.values():
|
for func in qutescheme.HANDLERS.values():
|
||||||
yield 'qutebrowser.browser.webkit.network.qutescheme.' + func.__name__
|
yield 'qutebrowser.browser.webkit.network.qutescheme.' + func.__name__
|
||||||
|
|
||||||
# Globals
|
|
||||||
# https://bitbucket.org/jendrikseipp/vulture/issues/10/
|
|
||||||
yield 'qutebrowser.misc.utilcmds.pyeval_output'
|
|
||||||
yield 'utils.use_color'
|
|
||||||
yield 'qutebrowser.browser.webkit.mhtml.last_used_directory'
|
|
||||||
yield 'qutebrowser.utils.utils.fake_clipboard'
|
|
||||||
yield 'qutebrowser.utils.utils.log_clipboard'
|
|
||||||
|
|
||||||
# Other false-positives
|
# Other false-positives
|
||||||
yield ('qutebrowser.completion.models.sortfilter.CompletionFilterModel().'
|
yield ('qutebrowser.completion.models.sortfilter.CompletionFilterModel().'
|
||||||
'lessThan')
|
'lessThan')
|
||||||
@ -127,9 +119,9 @@ def report(items):
|
|||||||
properties which get used for the items.
|
properties which get used for the items.
|
||||||
"""
|
"""
|
||||||
output = []
|
output = []
|
||||||
for item in sorted(items, key=lambda e: (e.file.lower(), e.lineno)):
|
for item in sorted(items, key=lambda e: (e.filename.lower(), e.lineno)):
|
||||||
relpath = os.path.relpath(item.file)
|
relpath = os.path.relpath(item.filename)
|
||||||
path = relpath if not relpath.startswith('..') else item.file
|
path = relpath if not relpath.startswith('..') else item.filename
|
||||||
output.append("{}:{}: Unused {} '{}'".format(path, item.lineno,
|
output.append("{}:{}: Unused {} '{}'".format(path, item.lineno,
|
||||||
item.typ, item))
|
item.typ, item))
|
||||||
return output
|
return output
|
||||||
|
@ -138,26 +138,3 @@ def test_unused_method_camelcase(vultdir):
|
|||||||
Foo()
|
Foo()
|
||||||
""")
|
""")
|
||||||
assert not vultdir.run()
|
assert not vultdir.run()
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.xfail(
|
|
||||||
True, reason="https://bitbucket.org/jendrikseipp/vulture/issues/10/")
|
|
||||||
def test_globals_bug(vultdir):
|
|
||||||
"""Vulture has a bug where it detects globals as unused.
|
|
||||||
|
|
||||||
When this test starts XPASSing, we know it's been fixed.
|
|
||||||
"""
|
|
||||||
vultdir.makepyfile(foo="""
|
|
||||||
import bar
|
|
||||||
|
|
||||||
bar.attr = True
|
|
||||||
bar.blub()
|
|
||||||
""")
|
|
||||||
vultdir.makepyfile(bar="""
|
|
||||||
attr = False
|
|
||||||
|
|
||||||
def blub():
|
|
||||||
if attr:
|
|
||||||
print("Hey!")
|
|
||||||
""")
|
|
||||||
assert not vultdir.run()
|
|
||||||
|
Loading…
Reference in New Issue
Block a user