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

[red-knot] Unresolved imports lint rule #11164

Merged
merged 2 commits into from Apr 28, 2024

Conversation

MichaReiser
Copy link
Member

Summary

This PR is based on #11157 and #11148

It implements a very basic check for detecting unknown imports. It doesn't do anything fancy but it demonstrates the cross-module resolution infrastructure.

The lint_semantic isn't yet correctly retriggered when a dependency changes. That's something we have to follow up with.

Test Plan

I imported the test function from match.py. No lint error. I imported the non existing test2 function from match.py and it shows a diagnostic.

@MichaReiser MichaReiser changed the base branch from main to red-knot-program-check April 26, 2024 12:08
@MichaReiser MichaReiser force-pushed the red-knot-lint-unresolved-imports branch from b6d0bc4 to 70b5a0d Compare April 26, 2024 12:12
Copy link
Contributor

@carljm carljm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Sorry about the rebase pain due to the changes I made to my PR before merge.

crates/red_knot/src/lint.rs Show resolved Hide resolved
crates/red_knot/src/lint.rs Outdated Show resolved Hide resolved
crates/red_knot/src/lint.rs Outdated Show resolved Hide resolved
crates/red_knot/src/lint.rs Show resolved Hide resolved
crates/red_knot/src/types.rs Show resolved Hide resolved
@MichaReiser MichaReiser force-pushed the red-knot-program-check branch 2 times, most recently from aca0d3d to 636ca68 Compare April 27, 2024 08:54
Base automatically changed from red-knot-program-check to main April 27, 2024 09:01
@MichaReiser MichaReiser force-pushed the red-knot-lint-unresolved-imports branch 3 times, most recently from f3d7ea9 to c692b44 Compare April 27, 2024 17:30
@MichaReiser MichaReiser added the internal An internal refactor or improvement label Apr 27, 2024
@MichaReiser MichaReiser changed the base branch from main to red-knot-relative-imports April 27, 2024 17:30
@MichaReiser MichaReiser force-pushed the red-knot-lint-unresolved-imports branch from c692b44 to cc4a923 Compare April 27, 2024 17:32
Copy link

github-actions bot commented Apr 27, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Base automatically changed from red-knot-relative-imports to main April 27, 2024 18:07
@MichaReiser MichaReiser force-pushed the red-knot-lint-unresolved-imports branch from cc4a923 to 4b48fb5 Compare April 28, 2024 10:04
@MichaReiser MichaReiser merged commit 3474e37 into main Apr 28, 2024
19 checks passed
@MichaReiser MichaReiser deleted the red-knot-lint-unresolved-imports branch April 28, 2024 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal An internal refactor or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants