2020
2121import nox
2222
23- BLACK_VERSION = "black==24.10.0"
24- ISORT_VERSION = "isort==5.13.2"
2523
2624LINT_PATHS = ["google" , "tests" , "noxfile.py" ]
2725
@@ -36,32 +34,16 @@ def lint(session):
3634 """
3735 session .install ("-r" , "requirements.txt" )
3836 session .install (
39- "flake8" ,
40- "flake8-annotations" ,
37+ "ruff" ,
4138 "mypy" ,
42- BLACK_VERSION ,
43- ISORT_VERSION ,
4439 "twine" ,
4540 "build" ,
4641 "importlib_metadata==7.2.1" ,
4742 )
4843 session .run (
49- "isort" ,
50- "--fss" ,
51- "--check-only" ,
52- "--diff" ,
53- "--profile=black" ,
54- "--force-single-line-imports" ,
55- "--dont-order-by-type" ,
56- "--single-line-exclusions=typing" ,
57- "-w=88" ,
58- * LINT_PATHS ,
59- )
60- session .run ("black" , "--check" , "--diff" , * LINT_PATHS )
61- session .run (
62- "flake8" ,
63- "google" ,
64- "tests" ,
44+ "ruff" ,
45+ "check" ,
46+ * LINT_PATHS ,
6547 )
6648 session .run (
6749 "mypy" ,
@@ -75,28 +57,19 @@ def lint(session):
7557 session .run ("python" , "-m" , "build" , "--sdist" )
7658 session .run ("twine" , "check" , "--strict" , "dist/*" )
7759
78-
7960@nox .session ()
8061def format (session ):
8162 """
82- Run isort to sort imports. Then run black
63+ Run isort to sort imports. Then run black
8364 to format code to uniform standard.
8465 """
85- session .install (BLACK_VERSION , ISORT_VERSION )
66+ session .install ("ruff" )
8667 # Use the --fss option to sort imports using strict alphabetical order.
8768 # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sectionss
8869 session .run (
89- "isort" ,
90- "--fss" ,
91- "--profile=black" ,
92- "--force-single-line-imports" ,
93- "--dont-order-by-type" ,
94- "--single-line-exclusions=typing" ,
95- "-w=88" ,
96- * LINT_PATHS ,
97- )
98- session .run (
99- "black" ,
70+ "ruff" ,
71+ "check" ,
72+ "--fix" ,
10073 * LINT_PATHS ,
10174 )
10275
0 commit comments