-
-
Notifications
You must be signed in to change notification settings - Fork 336
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
feat: new cli option --use-exact-imports #1983
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1983 +/- ##
=======================================
Coverage ? 98.81%
=======================================
Files ? 37
Lines ? 4212
Branches ? 981
=======================================
Hits ? 4162
Misses ? 31
Partials ? 19
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
CodSpeed Performance ReportMerging #1983 will not alter performanceComparing Summary
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm 👍
Feel free to also link #1683 to this PR, I can't do it myself.
if imports.use_exact: | ||
from_, import_ = exact_import( | ||
from_, import_, data_type.reference.short_name | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The repo prefer cover almost lines by the unittest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hiya @koxudaxi, I'm not entirely sure how to test these lines 😓 I can't find any existing tests for this class method (Parser.__change_from_import
) so I've got nothing to base it on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alpoi-x I think there are tests for executing the whole command. You could just take one of these and test the new option with multi-file-output (I don't remember where this test is but I think, I saw it few months ago). You could then assert that the imports look the way you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alpoi-x @lord-haffi
Thank you for creating the PR.
I left a few comments.
Otherwise, It looks good!!
Adds a new CLI options
--use-exact-imports
(off by default) to import types directly instead of modules. For example:becomes
Resolves #1982 and potentially #1683