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

Variable named "time" incorrectly marked as "Undefined name" (F821) in Jupyter notebook #376

Closed
wizardrix opened this issue Dec 30, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@wizardrix
Copy link

In Jupyter notebook I'm getting the hint "Undefined name time - Ruff(F821)" when I'm specifically using a variable with the name "time" and reference it in another cell.

Minimal example to reproduce:

First cell

time = "hi"

(this is not marked)

Second cell

test = time + " hello"

(here "time" is marked)

relevant settings:

{
	"[python]": {
		"editor.defaultFormatter": "charliermarsh.ruff"
	},
	"python.analysis.typeCheckingMode": "basic",
	"python.analysis.diagnosticSeverityOverrides": {
		"reportPrivateUsage": "error"
	},
	"notebook.formatOnSave.enabled": true,
	"notebook.showCellStatusBar": "hidden",
	"notebook.insertFinalNewline": false,
	"editor.largeFileOptimizations": false
}

VS Code 1.85.1
Ruff v2023.60.0

@charliermarsh
Copy link
Member

I believe this is the same as astral-sh/ruff#8526 -- we have trouble distinguishing variables from magic commands of the same name. Merging into that issue...

@charliermarsh charliermarsh closed this as not planned Won't fix, can't repro, duplicate, stale Jan 2, 2024
@charliermarsh charliermarsh added the bug Something isn't working label Jan 2, 2024
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

No branches or pull requests

2 participants