mirror of
				https://github.com/astral-sh/ruff.git
				synced 2025-11-03 21:24:29 +00:00 
			
		
		
		
	## Summary This PR moves `ruff/jupyter` into its own `ruff_notebook` crate. Beyond the move itself, there were a few challenges: 1. `ruff_notebook` relies on the source map abstraction. I've moved the source map into `ruff_diagnostics`, since it doesn't have any dependencies on its own and is used alongside diagnostics. 2. `ruff_notebook` has a couple tests for end-to-end linting and autofixing. I had to leave these tests in `ruff` itself. 3. We had code in `ruff/jupyter` that relied on Python lexing, in order to provide a more targeted error message in the event that a user saves a `.py` file with a `.ipynb` extension. I removed this in order to avoid a dependency on the parser, it felt like it wasn't worth retaining just for that dependency. ## Test Plan `cargo test`
		
			
				
	
	
		
			24 lines
		
	
	
	
		
			259 B
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
	
		
			259 B
		
	
	
	
		
			Text
		
	
	
	
	
	
#!/usr/bin/env python
 | 
						|
# coding: utf-8
 | 
						|
 | 
						|
# In[1]:
 | 
						|
 | 
						|
 | 
						|
def unused_variable():
 | 
						|
    x = 1
 | 
						|
    y = 2
 | 
						|
    print(f"cell one: {y}")
 | 
						|
 | 
						|
unused_variable()
 | 
						|
 | 
						|
 | 
						|
# Let's do another mistake
 | 
						|
 | 
						|
# In[2]:
 | 
						|
 | 
						|
 | 
						|
def mutable_argument(z=set()):
 | 
						|
  print(f"cell two: {z}")
 | 
						|
 | 
						|
mutable_argument()
 | 
						|
 |