Repository: Project-MONAI/MONAI
File: runtests.sh (Shell)

Code before:
doNetTests=false
doDryRun=false
doZooTests=false
doUnitTests=false
doBuild=false
doBlackFormat=false
doBlackFix=false
doIsortFormat=false
doIsortFix=false
doPylintFormat=false
doRuffFormat=false
doRuffFix=false
doClangFormat=false
doCopyRight=false
doPytypeFormat=false
doMypyFormat=false
doCleanup=false
doDistTests=false
doPrecommit=false

NUM_PARALLEL=1

PY_EXE=${MONAI_PY_EXE:-$(which python)}

function print_usage {
    echo "runtests.sh [--codeformat] [--autofix] [--black] [--isort] [--pylint] [--ruff]"
    echo "            [--clangformat] [--precommit] [--pytype] [-j number] [--mypy]"
    echo "            [--unittests] [--disttests] [--coverage] [--quick] [--min] [--net] [--build] [--list_tests]"
    echo "            [--dryrun] [--copyright] [--clean] [--help] [--version] [--path] [--formatfix]"
    echo ""
    echo "MONAI unit testing utilities."
    echo ""
    echo "Examples:"
    echo "./runtests.sh -f -u --net --coverage  # run style checks, full tests, print code coverage (${green}recommended for pull requests${noColor})."
    echo "./runtests.sh -f -u                   # run style checks and unit tests."
    echo "./runtests.sh -f                      # run coding style and static type checking."
    echo "./runtests.sh --quick --unittests     # run minimal unit tests, for quick verification during code developments."
    echo "./runtests.sh --autofix               # run automatic code formatting using \"isort\" and \"black\"."
    echo "./runtests.sh --clean                 # clean up temporary files and run \"${PY_EXE} setup.py develop --uninstall\"."
    echo "./runtests.sh --formatfix -p /my/code # run automatic code formatting using \"isort\" and \"black\" in specified path."
    echo ""
    echo "Code style check options:"
    echo "    --autofix         : format code using \"isort\" and \"black\""
    echo "    --black           : perform \"black\" code format checks"
    echo "    --isort           : perform \"isort\" import sort checks"
    echo "    --pylint          : perform \"pylint\" code format checks"
    echo "    --ruff            : perform \"ruff\" code format checks"
    echo "    --clangformat     : format csrc code using \"clang-format\""
    echo "    --precommit       : perform source code format check and fix using \"pre-commit\""
    echo ""
    echo "Python type check options:"

Review comment (suggestion):
I would recommend aliasing the "--flake8" to "--ruff" with a deprecation warning.  For backwards compatibility for some amount of time to ease the transition of scripts and documentation that are used by developers.

Code after:
doNetTests=false
doDryRun=false
doZooTests=false
doUnitTests=false
doBuild=false
doBlackFormat=false
doBlackFix=false
doIsortFormat=false
doIsortFix=false
doPylintFormat=false
doRuffFormat=false
doRuffFix=false
doClangFormat=false
doCopyRight=false
doPytypeFormat=false
doMypyFormat=false
doCleanup=false
doDistTests=false
doPrecommit=false

NUM_PARALLEL=1

PY_EXE=${MONAI_PY_EXE:-$(which python)}

function print_usage {
    echo "runtests.sh [--codeformat] [--autofix] [--black] [--isort] [--pylint] [--ruff]"
    echo "            [--clangformat] [--precommit] [--pytype] [-j number] [--mypy]"
    echo "            [--unittests] [--disttests] [--coverage] [--quick] [--min] [--net] [--build] [--list_tests]"
    echo "            [--dryrun] [--copyright] [--clean] [--help] [--version] [--path] [--formatfix]"
    echo ""
    echo "MONAI unit testing utilities."
    echo ""
    echo "Examples:"
    echo "./runtests.sh -f -u --net --coverage  # run style checks, full tests, print code coverage (${green}recommended for pull requests${noColor})."
    echo "./runtests.sh -f -u                   # run style checks and unit tests."
    echo "./runtests.sh -f                      # run coding style and static type checking."
    echo "./runtests.sh --quick --unittests     # run minimal unit tests, for quick verification during code developments."
    echo "./runtests.sh --autofix               # run automatic code formatting using \"isort\" and \"black\"."
    echo "./runtests.sh --clean                 # clean up temporary files and run \"${PY_EXE} -m pip uninstall -y monai\"."
    echo "./runtests.sh --formatfix -p /my/code # run automatic code formatting using \"isort\" and \"black\" in specified path."
    echo ""
    echo "Code style check options:"
    echo "    --autofix         : format code using \"isort\" and \"black\""
    echo "    --black           : perform \"black\" code format checks"
    echo "    --isort           : perform \"isort\" import sort checks"
    echo "    --pylint          : perform \"pylint\" code format checks"
    echo "    --ruff            : perform \"ruff\" code format checks"
    echo "    --flake8          : perform \"ruff\" code format checks (deprecated alias for --ruff)"
    echo "    --clangformat     : format csrc code using \"clang-format\""
    echo "    --precommit       : perform source code format check and fix using \"pre-commit\""
    echo ""