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

Consider access information when computing qualified names for nodes #682

Merged
merged 4 commits into from
May 4, 2022

Conversation

lpetre
Copy link
Contributor

@lpetre lpetre commented May 3, 2022

Summary

Scope.get_qualified_names_for has to do a lot of work to determine the qualified name for a node. The current version does not consider the data we have for accesses. If the given node is known to be an access, we can take advantage of that to work out the proper name.

This also means we now get the qualified names for string annotations for imports.

Test Plan

I've added a new test case in the QualifiedNameProviderTest to show the before/after effects of this change

@lpetre lpetre requested a review from zsol May 3, 2022 19:21
@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 May 3, 2022
@codecov-commenter
Copy link

codecov-commenter commented May 3, 2022

Codecov Report

Merging #682 (8bf7c0f) into main (6e0c63a) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #682   +/-   ##
=======================================
  Coverage   94.81%   94.81%           
=======================================
  Files         246      246           
  Lines       25607    25620   +13     
=======================================
+ Hits        24279    24292   +13     
  Misses       1328     1328           
Impacted Files Coverage Δ
libcst/metadata/scope_provider.py 95.49% <100.00%> (+0.02%) ⬆️
libcst/metadata/tests/test_name_provider.py 100.00% <100.00%> (ø)

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 6e0c63a...8bf7c0f. Read the comment docs.

Copy link
Member

@zsol zsol left a comment

Choose a reason for hiding this comment

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

lgtm!

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.

4 participants