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

ScopeProvider: Record Access for Attributes and Decorators #1019

Merged
merged 3 commits into from
Oct 1, 2023

Conversation

andrecsilva
Copy link
Contributor

@andrecsilva andrecsilva commented Sep 15, 2023

Summary

Fixes #1018 by making all calls to _NameUtil.get_name_for() use get_full_name_for_node() instead.

@facebook-github-bot
Copy link

Hi @andrecsilva!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@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 Sep 15, 2023
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.

Is there any reason for keeping a duplicate around? Could we just delete this function and use get_full_name_for_node?

In any case, let's write tests, please :)

@codecov-commenter
Copy link

codecov-commenter commented Sep 16, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (37277e5) 91.04% compared to head (d5b58d2) 91.05%.
Report is 5 commits behind head on main.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1019      +/-   ##
==========================================
+ Coverage   91.04%   91.05%   +0.01%     
==========================================
  Files         255      255              
  Lines       26366    26370       +4     
==========================================
+ Hits        24004    24011       +7     
+ Misses       2362     2359       -3     
Files Coverage Δ
libcst/metadata/scope_provider.py 96.03% <100.00%> (+0.39%) ⬆️
libcst/metadata/tests/test_scope_provider.py 99.89% <100.00%> (+<0.01%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@andrecsilva
Copy link
Contributor Author

andrecsilva commented Sep 18, 2023

Good call. I wasn't sure why it was separate in the first place so I'd elected to just maintain it.

I've removed _NameUtil entirely and added a couple tests covering dotted imports and decorators.

@zsol zsol changed the title Support for Attributes and Decorators in _NameUtil ScopeProvider: Record Access for Attributes and Decorators Oct 1, 2023
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.

Thanks!

@zsol zsol merged commit 552af63 into Instagram:main Oct 1, 2023
23 of 24 checks passed
manmartgarc pushed a commit to manmartgarc/LibCST that referenced this pull request Oct 3, 2023
…#1019)

* Support for Attributes and Decorators in _NameUtil

* Replaced _NameUtil with get_full_name_for_node

* Added tests
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.

Cannot reference an access by its node from its scope
4 participants