Skip to content

[Linter panic] Trouble handling a syntax error #8262

@chaburkland

Description

@chaburkland

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions