Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pin accesses to import alias node #554

Merged
merged 6 commits into from
Nov 19, 2021
Merged

Conversation

giomeg
Copy link
Contributor

@giomeg giomeg commented Nov 18, 2021

Summary

Add ImportAssignment class extending Assignment to record assignments for import statements.

Test Plan

python -m unittest libcst.metadata.tests.test_scope_provider
python -m unittest libcst.codemod.visitors.tests.test_gather_unused_imports

Closes #485

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 18, 2021
@giomeg giomeg requested review from zsol and lpetre November 18, 2021 19:21
@codecov-commenter
Copy link

codecov-commenter commented Nov 18, 2021

Codecov Report

Merging #554 (21d1471) into main (5c05001) will decrease coverage by 0.00%.
The diff coverage is 97.05%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #554      +/-   ##
==========================================
- Coverage   94.77%   94.77%   -0.01%     
==========================================
  Files         235      235              
  Lines       23254    23273      +19     
==========================================
+ Hits        22040    22058      +18     
- Misses       1214     1215       +1     
Impacted Files Coverage Δ
libcst/codemod/visitors/_gather_unused_imports.py 98.33% <ø> (ø)
libcst/metadata/__init__.py 100.00% <ø> (ø)
libcst/metadata/scope_provider.py 95.64% <95.65%> (+0.07%) ⬆️
libcst/metadata/tests/test_scope_provider.py 99.88% <100.00%> (+<0.01%) ⬆️
setup.py 87.50% <0.00%> (-12.50%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5c05001...21d1471. Read the comment docs.

Copy link
Contributor

@lpetre lpetre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great to me, thanks for working on this.

@zsol
Copy link
Member

zsol commented Nov 18, 2021

lgtm

@giomeg giomeg merged commit ae8d0cd into main Nov 19, 2021
@giomeg giomeg deleted the pin_accesses_to_import_alias_node branch November 19, 2021 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scope provider should pin accesses to the ImportAlias node
5 participants