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

Add forward reference annotation detection #379

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Joko013
Copy link

@Joko013 Joko013 commented Dec 15, 2024

Adding support for parsing forward references in type annotations and using them for the detection algorithm.

Description

Hi, I'd like to add the support for forward references so I would appreciate it if you could take a look at this draft.

I understand that it has been discussed but I think it's worth reconsidering, given the timeframe (the original discussion is from 2020) and further adoption of new Python versions.

Personally, this blocks the usage of Vulture as it either forces you to adopt a new standard (from __future__ import annotations instead of if TYPE_CHECKING:...) or deal with a lot of false positives if you don't (or can't).

I know that in the original discussion, there's been concerns about the issues that this could open up so I've tried to cover some basic cases but I'm all for for covering more.

Let me know if this approach makes sense to you.

Related Issue

Checklist:

  • I have updated the documentation in the README.md file or my changes don't require an update.
  • I have added an entry in CHANGELOG.md.
  • I have added or adapted tests to cover my changes.
  • I have run pre-commit run --all-files to format and lint my code.

@jendrikseipp
Copy link
Owner

Thanks for the PR! I'll take a look when I find the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants