This repository was archived by the owner on Mar 26, 2026. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +31
-10
lines changed
Expand file tree Collapse file tree 1 file changed +31
-10
lines changed Original file line number Diff line number Diff line change @@ -758,23 +758,14 @@ def lint(session):
758758 serious code quality issues.
759759 """
760760 session .install ("flake8" , RUFF_VERSION )
761-
762- # 1. Check imports
763- session .run (
764- "ruff" ,
765- "check" ,
766- "--select" , "I" ,
767- * LINT_PATHS ,
768- "--extend-exclude" , RUFF_EXCLUDES ,
769- )
770761
771762 # 2. Check formatting
772763 session .run (
773764 "ruff" ,
774765 "format" ,
775766 "--check" ,
776767 * LINT_PATHS ,
777- "--extend- exclude" , RUFF_EXCLUDES ,
768+ "--exclude" , RUFF_EXCLUDES ,
778769 )
779770
780771 # 3. Run Flake8
@@ -805,3 +796,33 @@ def blacken(session):
805796 * LINT_PATHS ,
806797 "--extend-exclude" , RUFF_EXCLUDES ,
807798 )
799+
800+
801+ @nox .session (python = NEWEST_PYTHON )
802+ def format (session ):
803+ """
804+ Run ruff to sort imports and format code.
805+ """
806+ # 1. Install ruff (skipped automatically if you run with --no-venv)
807+ session .install ("ruff" )
808+
809+ # 2. Run Ruff to fix imports
810+ # check --select I: Enables strict import sorting
811+ # --fix: Applies the changes automatically
812+ session .run (
813+ "ruff" ,
814+ "check" ,
815+ "--select" ,
816+ "I" ,
817+ "--fix" ,
818+ "--line-length=88" , # Standard Black line length
819+ * LINT_PATHS ,
820+ )
821+
822+ # 3. Run Ruff to format code
823+ session .run (
824+ "ruff" ,
825+ "format" ,
826+ "--line-length=88" , # Standard Black line length
827+ * LINT_PATHS ,
828+ )
You can’t perform that action at this time.
0 commit comments