-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Fix reportPrivateImportUsage errors disappearing #11237
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
base: main
Are you sure you want to change the base?
Fix reportPrivateImportUsage errors disappearing #11237
Conversation
|
@pt-anthropic please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
fb5ae45 to
1282409
Compare
…is tracked When a py.typed package was added to check paths (e.g., via command line), reportPrivateImportUsage errors would incorrectly disappear. This happened because addTrackedFile() was creating source files with isInPyTypedPackage=false without detecting the actual py.typed status. The fix detects py.typed status using _getModuleImportInfoForFile() when adding tracked files, similar to how setFileOpened() already does. This ensures that files from py.typed packages are correctly marked even when added directly to check paths. Added test case that reproduces the bug scenario with three packages where pkg_b re-imports from pkg_a without re-exporting, and pkg_c imports from pkg_b.
1282409 to
d904088
Compare
When a py.typed package was added to check paths (e.g., via command line), reportPrivateImportUsage errors would incorrectly disappear. This happened because addTrackedFile() was creating source files with isInPyTypedPackage=false without detecting the actual py.typed status.
The fix detects py.typed status using _getModuleImportInfoForFile() when adding tracked files, similar to how setFileOpened() already does. This ensures that files from py.typed packages are correctly marked even when added directly to check paths.
Added test case that reproduces the bug scenario with three packages where pkg_b re-imports from pkg_a without re-exporting, and pkg_c imports from pkg_b.