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:
Florian Bruhin 2016-06-29 23:32:07 +02:00
parent cd136b7b33
commit 03fbacd93c
4 changed files with 5 additions and 36 deletions

View File

@ -28,5 +28,5 @@ pytest-rerunfailures==2.0.0
pytest-travis-fold==1.2.0
pytest-xvfb==0.2.0
six==1.10.0
vulture==0.8.1
vulture==0.9
Werkzeug==0.11.10

View File

@ -1,3 +1,3 @@
# This file is automatically generated by scripts/dev/recompile_requirements.py
vulture==0.8.1
vulture==0.9

View File

@ -77,14 +77,6 @@ def whitelist_generator():
for func in qutescheme.HANDLERS.values():
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
yield ('qutebrowser.completion.models.sortfilter.CompletionFilterModel().'
'lessThan')
@ -127,9 +119,9 @@ def report(items):
properties which get used for the items.
"""
output = []
for item in sorted(items, key=lambda e: (e.file.lower(), e.lineno)):
relpath = os.path.relpath(item.file)
path = relpath if not relpath.startswith('..') else item.file
for item in sorted(items, key=lambda e: (e.filename.lower(), e.lineno)):
relpath = os.path.relpath(item.filename)
path = relpath if not relpath.startswith('..') else item.filename
output.append("{}:{}: Unused {} '{}'".format(path, item.lineno,
item.typ, item))
return output

View File

@ -138,26 +138,3 @@ def test_unused_method_camelcase(vultdir):
Foo()
""")
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()