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

[Linter panic] Trouble handling a syntax error #8262

Closed
chaburkland opened this issue Oct 26, 2023 · 2 comments · Fixed by #8154
Closed

[Linter panic] Trouble handling a syntax error #8262

chaburkland opened this issue Oct 26, 2023 · 2 comments · Fixed by #8154
Labels
bug Something isn't working

Comments

@chaburkland
Copy link

Ruff version: ruff 0.0.292

File ruff_example.py:

status = "unknown"
job_id = 14

raise RuntimeError(f"Unknown {status]} for {job_id=}")

Command:

ruff ruff_example.py # NOTE: The error did not occur when using the `--isolated` flag

Config pyproject.toml:

[tool.ruff]
target-version = "py38"
exclude = [
	".git",
	"__pycache__",
	".mypy_cache",
	".ruff_cache",
]
ignore = [
	"B011",     
	"B015",     
	"B023",     
	"B028",     
	"F811",     
	"F841",     
	"PLR0911",  
	"PLR0912",  
	"PLR0913",  
	"PLR0915",  
	"PLW2901",  
	"PLW3301",  
	"RUF001",   
	"RUF002",   
	"RUF003",   
	"RUF005",   
	"RUF012",   
	"UP025",    
	"PLR1711",  
	"PLR2004",  
	"PLR5501",  
	"PIE794",
	"F821",     
	"PLC0414",  
]
select = [
	"F",   
	"W",   
	"UP",  
	"B",   
	"T10", 
	"EXE", 
	"ISC", 
	"ICN", 
	"PIE", 
	"RSE", 
	"TCH", 
	"PGH", 
	"PL",  
	"NPY", 
	"RUF", 
]

Dump:

error: Panicked while linting ruff_example.py: This indicates a bug in Ruff. If you could open an issue at:

    https://github.com/astral-sh/ruff/issues/new?title=%5BLinter%20panic%5D

...with the relevant file contents, the `pyproject.toml` settings, and the following stack trace, we'd be very appreciative!

panicked at 'called `Option::unwrap()` on a `None` value', crates/ruff_linter/src/rules/pycodestyle/rules/invalid_escape_sequence.rs:177:22
Backtrace:    0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: <unknown>
  14: <unknown>
  15: <unknown>
  16: <unknown>
  17: <unknown>
  18: __libc_start_main
             at /build/glibc-BHL3KM/glibc-2.31/csu/../csu/libc-start.c:308:16
  19: <unknown>
@charliermarsh
Copy link
Member

Thanks, reproduced!

@charliermarsh
Copy link
Member

@dhruvmanila - Do you mind taking this one? Looks like it's related to an fstring_ranges unwrap in that rule.

@charliermarsh charliermarsh added the bug Something isn't working label Oct 26, 2023
@dhruvmanila dhruvmanila linked a pull request Oct 27, 2023 that will close this issue
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 a pull request may close this issue.

2 participants