Closed jingw closed 4 years ago
Good point! I agree that folding used_attrs into used_names makes sense (i.e., storing all used attributes in used_names and dropping the used_attrs set and the get_set function). Do you want to create a pull request for this?
Yep, I can put together that change.
Consider the following code in two files:
Running vulture complains that
module.some_module_var
is an unused attributeHow do you feel about this? On one hand, in practice, the cases where I've seen this false positive were test cases that should have been refactored to use
mock.patch
instead of directly setting module attributes. On the other hand, it's still a legitimate false positive, and someone could conceivably write non-test code like this.I imagine other classes of false positives may be caused by separating attrs and names. One example that comes to mind is
Fixing this can be done by combining used_attrs with used_names in unused_attrs, though that largely defeats the point of separating these. I suppose it's not crazy to collapse them into a single used_names though.