Skip to content

Update E402 to work at cell level for notebooks#8872

Merged
dhruvmanila merged 3 commits intomainfrom
dhruv/e402-notebook
Nov 29, 2023
Merged

Update E402 to work at cell level for notebooks#8872
dhruvmanila merged 3 commits intomainfrom
dhruv/e402-notebook

Conversation

@dhruvmanila
Copy link
Copy Markdown
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
Copy Markdown
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
@github-actions
Copy link
Copy Markdown
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
@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