vulture icon indicating copy to clipboard operation
vulture copied to clipboard

Fix false positive when iterating over `Enum`

Open anudaweerasinghe opened this issue 1 year ago • 1 comments

Description

  • Creates dictionary enum_class_vars that maps subclasses of Enum to variables defined within them
  • Updates visit_Call to add values in enum_class_vars to used_names if the function is list, tuple, or set and the argument is a subclass of Enum
  • Implements visit_For to handle the case where we iterate over an Enum, i.e. for e in E

Related Issue

Resolves #304

Checklist:

  • [x] I have updated the documentation in the README.md file or my changes don't require an update.
  • [X] I have added an entry in CHANGELOG.md.
  • [X] I have added or adapted tests to cover my changes.
  • [X] I have run tox -e fix-style to format my code and checked the result with tox -e style.

anudaweerasinghe avatar May 06 '23 22:05 anudaweerasinghe

Codecov Report

Merging #312 (8743ead) into main (e2e84d0) will increase coverage by 0.03%. The diff coverage is 100.00%.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main     #312      +/-   ##
==========================================
+ Coverage   98.94%   98.98%   +0.03%     
==========================================
  Files          21       21              
  Lines         665      689      +24     
==========================================
+ Hits          658      682      +24     
  Misses          7        7              
Impacted Files Coverage Δ
vulture/core.py 98.63% <100.00%> (+0.09%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov-commenter avatar May 06 '23 23:05 codecov-commenter