@@ -28,9 +28,27 @@ def test(s: Session) -> None:
2828# For some sessions, set venv_backend="none" to simply execute scripts within the existing Poetry
2929# environment. This requires that nox is run within `poetry shell` or using `poetry run nox ...`.
3030@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 )
3452
3553
3654@session (venv_backend = "none" )
@@ -47,7 +65,7 @@ def lint(s: Session, command: list[str]) -> None:
4765
4866@session (venv_backend = "none" )
4967def lint_fix (s : Session ) -> None :
50- s .run ("ruff" , "check" , "." , "--fix" )
68+ s .run ("ruff" , "check" , "." , "--extend-fixable" , "F401" , "-- fix" )
5169
5270
5371@session (venv_backend = "none" )
0 commit comments