@@ -28,9 +28,27 @@ def test(s: Session) -> None:
28
28
# For some sessions, set venv_backend="none" to simply execute scripts within the existing Poetry
29
29
# environment. This requires that nox is run within `poetry shell` or using `poetry run nox ...`.
30
30
@session (venv_backend = "none" )
31
- def fmt (s : Session ) -> None :
32
- s .run ("ruff" , "check" , "." , "--select" , "I" , "--fix" )
33
- s .run ("ruff" , "format" , "." )
31
+ @parametrize (
32
+ "command" ,
33
+ [
34
+ # During formatting, additionally sort imports and remove unused imports.
35
+ [
36
+ "ruff" ,
37
+ "check" ,
38
+ "." ,
39
+ "--select" ,
40
+ "I" ,
41
+ "--select" ,
42
+ "F401" ,
43
+ "--extend-fixable" ,
44
+ "F401" ,
45
+ "--fix" ,
46
+ ],
47
+ ["ruff" , "format" , "." ],
48
+ ],
49
+ )
50
+ def fmt (s : Session , command : list [str ]) -> None :
51
+ s .run (* command )
34
52
35
53
36
54
@session (venv_backend = "none" )
@@ -47,7 +65,7 @@ def lint(s: Session, command: list[str]) -> None:
47
65
48
66
@session (venv_backend = "none" )
49
67
def lint_fix (s : Session ) -> None :
50
- s .run ("ruff" , "check" , "." , "--fix" )
68
+ s .run ("ruff" , "check" , "." , "--extend-fixable" , "F401" , "-- fix" )
51
69
52
70
53
71
@session (venv_backend = "none" )
0 commit comments