[flake8-type-checking] Add sub-diagnostic showing the runtime use of an annotation (TC004)#23091
Conversation
|
ntBre
left a comment
There was a problem hiding this comment.
Thanks for working on this! I'm obviously a bit biased, but I think I would overall prefer my patch from #16490 (comment). I'm not as worried about the runtime_reference field being unused by TC001-TC003 now, it seems fine for those rules to pass None.
| && !(ignore_dunder_all_references && reference.in_dunder_all_definition()) | ||
| }) | ||
| { | ||
| .collect(); |
There was a problem hiding this comment.
The count field is a nice touch, but I don't think it's worth allocating a Vec here. I think flagging the first runtime reference with a secondary annotation is enough.
| Ignore, | ||
| } | ||
|
|
||
| struct RuntimeInformation { |
There was a problem hiding this comment.
I know I was the one who said
Storing this information in ImportBinding doesn't necessarily feel like the best approach
but I think I would still prefer my patch from #16490 (comment). This type doesn't seem to help all that much and also causes us to allocate several intermediate Vecs, at least in the current state of the PR.
There was a problem hiding this comment.
yes I also felt the same, however I thought would try this approach , no worries I will refactor it similar to your patch.
There was a problem hiding this comment.
Thank you for exploring this! It was good to see another approach :)
Signed-off-by: Bhuminjay <[email protected]>
b49f668 to
6fceea1
Compare
Signed-off-by: Bhuminjay <[email protected]>
|
done refactored to previous approach : ) |
ntBre
left a comment
There was a problem hiding this comment.
Nice, thank you!
Regarding #19359, I don't think I have any specific pointers besides checking what I did in #19100. I think I added a helper method or two that should be of use. Let me know if you run into any issues!
Ah, I guess one suggestion, I would probably start with either TC004 or TC010 instead of the UP rules since there's more of a design question around handling the UP and FA interaction.
flake8-type-checking] Add sub-diagnostic showing the runtime use of an annotation (TC004)
Summary
Part of #17203, have not changed
ImportBinding#16490 (comment)Test Plan
Updated snapshots.