Skip to content

Conversation

@charliermarsh
Copy link
Member

@charliermarsh charliermarsh commented Jan 26, 2024

Summary

Given a statement like colors = 6, we currently treat the cell as an automagic (since colors is an automagic) -- i.e., we assume it's equivalent to %colors = 6. This PR adds some additional detection whereby if the statement is an assignment, we avoid treating it as such. I audited the list of automagics, and I believe this is safe for all of them.

Closes #8526.

Closes #9648.

Test Plan

cargo test

@github-actions
Copy link
Contributor

github-actions bot commented Jan 26, 2024

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+0 -3 violations, +0 -0 fixes in 1 projects; 42 projects unchanged)

mlflow/mlflow (+0 -3 violations, +0 -0 fixes)

- examples/llms/RAG/question-generation-retrieval-evaluation.ipynb:cell 14:1:1: F821 Undefined name `df`
- examples/llms/RAG/question-generation-retrieval-evaluation.ipynb:cell 4:14:8: F401 [*] `requests` imported but unused
- examples/llms/RAG/question-generation-retrieval-evaluation.ipynb:cell 4:16:17: F401 [*] `bs4.BeautifulSoup` imported but unused

Changes by rule (2 rules affected)

code total + violation - violation + fix - fix
F401 2 0 2 0 0
F821 1 0 1 0 0

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+0 -3 violations, +0 -0 fixes in 1 projects; 42 projects unchanged)

mlflow/mlflow (+0 -3 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --preview

- examples/llms/RAG/question-generation-retrieval-evaluation.ipynb:cell 14:1:1: F821 Undefined name `df`
- examples/llms/RAG/question-generation-retrieval-evaluation.ipynb:cell 4:14:8: F401 [*] `requests` imported but unused
- examples/llms/RAG/question-generation-retrieval-evaluation.ipynb:cell 4:16:17: F401 [*] `bs4.BeautifulSoup` imported but unused

Changes by rule (2 rules affected)

code total + violation - violation + fix - fix
F401 2 0 2 0 0
F821 1 0 1 0 0

@charliermarsh
Copy link
Member Author

Ecosystem checks are correct (i.e., they were false positives before the change).

@charliermarsh charliermarsh enabled auto-merge (squash) January 29, 2024 12:50
@charliermarsh charliermarsh merged commit bea8f2e into main Jan 29, 2024
@charliermarsh charliermarsh deleted the charlie/auto branch January 29, 2024 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

F821 false positive in notebook when using magic command as variables jupyter: ruff v0.1.4 ignores variables with the same name as magic commands

3 participants