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

Update E402 to work at cell level for notebooks #8872

Merged
merged 3 commits into from
Nov 29, 2023
Merged

Conversation

dhruvmanila
Copy link
Member

@dhruvmanila dhruvmanila commented Nov 28, 2023

Summary

This PR updates the E402 rule to work at cell level for Jupyter notebooks. This is enabled only in preview to gather feedback.

The implementation basically resets the import boundary flag on the semantic model when we encounter the first statement in a cell.

Another potential solution is to introduce E403 rule that is specifically for notebooks that works at cell level while E402 will be disabled for notebooks.

Test Plan

Add a notebook with imports in multiple cells and verify that the rule works as expected.

resolves: #8669

@dhruvmanila
Copy link
Member Author

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

@dhruvmanila dhruvmanila added the rule Implementing or modifying a lint rule label Nov 28, 2023
Copy link
Contributor

github-actions bot commented Nov 28, 2023

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

@dhruvmanila dhruvmanila enabled auto-merge (squash) November 29, 2023 00:26
@dhruvmanila dhruvmanila merged commit b28556d into main Nov 29, 2023
16 checks passed
@dhruvmanila dhruvmanila deleted the dhruv/e402-notebook branch November 29, 2023 00:32
@redeboer redeboer mentioned this pull request Apr 25, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Notebook related rule updates
2 participants