Skip to content

Commit 5a51a44

Browse files
committed
Invoke ruff through PY_EXE and drop its duplicated excludes
runtests.sh called ruff as a bare executable on PATH while isort, black, pylint and pytype all go through "${PY_EXE}" -m. The guard above it, is_pip_installed ruff, tests importlib.util.find_spec using PY_EXE, so the check interrogated one environment and the invocation ran whatever ruff PATH happened to offer. In a clean virtualenv built per CONTRIBUTING.md this makes ./runtests.sh --codeformat fail outright: ruff ./runtests.sh: line 598: ruff: command not found Check failed! and where a system ruff does exist it silently wins over the pinned one. The --exclude versioneer.py --exclude monai/_version.py flags are dropped because [tool.ruff] extend-exclude now carries them, so they apply however ruff is reached rather than only through this script. --unsafe-fixes is left on the fix path as-is; making it symmetric with the check path is a behaviour change and belongs on its own. Signed-off-by: Hans Johnson <hans-johnson@uiowa.edu>
1 parent 2aa2d14 commit 5a51a44

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

runtests.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -595,13 +595,13 @@ then
595595
then
596596
install_deps
597597
fi
598-
ruff --version
598+
${cmdPrefix}"${PY_EXE}" -m ruff --version
599599

600600
if [ $doRuffFix = true ]
601601
then
602-
ruff check --fix --unsafe-fixes --exclude versioneer.py --exclude "monai/_version.py" "$homedir"
602+
${cmdPrefix}"${PY_EXE}" -m ruff check --fix --unsafe-fixes "$homedir"
603603
else
604-
ruff check --exclude versioneer.py --exclude "monai/_version.py" "$homedir"
604+
${cmdPrefix}"${PY_EXE}" -m ruff check "$homedir"
605605
fi
606606

607607
ruff_status=$?

0 commit comments

Comments
 (0)