Closed kreathon closed 1 year ago
Merging #291 (a362a25) into main (e3d2da3) will increase coverage by
0.00%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## main #291 +/- ##
=======================================
Coverage 99.38% 99.38%
=======================================
Files 19 19
Lines 647 651 +4
=======================================
+ Hits 643 647 +4
Misses 4 4
Impacted Files | Coverage Δ | |
---|---|---|
vulture/core.py | 99.40% <100.00%> (+<0.01%) |
:arrow_up: |
vulture/whitelists/ast_whitelist.py | 100.00% <100.00%> (ø) |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
Great! Thanks @kreathon !
:star_struck: Awesome! Nice to see this addressed! Thanks, for taking up this issue @jendrikseipp & @kreathon !
Example
At the moment,
a
would be seen as unused. However, as nicely described by @exoriente, the code means something likeSo it is not a normal / dead "assignment" and
a
should not be seen as unused.Implementation
The actual code change is really trivial, since most of the desired behavior (for the match statement) is already handled by
visit_Name
:Limitations
__match_args__
are possible)case
: e.g. "case [1, a, *rest]" (a
andrest
is not handled i.e. checked if it is used in the case body). Currently, I do not see any problem implementing it in the future.Python Compatibility
For Python < 3.10 the
visit_MatchClass
should never be executed. Tests are guarded with@pytest.mark.skipif( sys.version_info < (3, 10), ...)
Related Issue
This PR is addressing the issue https://github.com/jendrikseipp/vulture/issues/276.
Checklist:
tox -e fix-style
to format my code and checked the result withtox -e style
.