diff --git a/.github/config/super-linter.env b/.github/config/super-linter.env index bb9a35e..e9558bc 100644 --- a/.github/config/super-linter.env +++ b/.github/config/super-linter.env @@ -8,8 +8,10 @@ VALIDATE_GIT_COMMITLINT=false VALIDATE_JSCPD=false # Use Biome instead of Prettier for JSON formatting (Biome uses tabs, Prettier uses spaces) VALIDATE_JSON_PRETTIER=false -# Use Ruff instead of Black for Python formatting +# Use Ruff instead of Black/Pylint/isort for Python VALIDATE_PYTHON_BLACK=false +VALIDATE_PYTHON_ISORT=false +VALIDATE_PYTHON_PYLINT=false # Enable auto-fix for relevant linters FIX_BIOME_FORMAT=true @@ -18,7 +20,7 @@ FIX_JSONC=true FIX_MARKDOWN=true FIX_MARKDOWN_PRETTIER=true FIX_NATURAL_LANGUAGE=true -FIX_PYTHON_ISORT=true +FIX_PYTHON_RUFF=true FIX_PYTHON_RUFF_FORMAT=true FIX_SHELL_SHFMT=true FIX_SPELL_CODESPELL=true diff --git a/tasks/lint/renovate-deps.py b/tasks/lint/renovate-deps.py index eacc028..6d69bb4 100755 --- a/tasks/lint/renovate-deps.py +++ b/tasks/lint/renovate-deps.py @@ -132,6 +132,10 @@ def is_true(var): "Run 'mise run lint:renovate-deps --autofix' to create it.", file=sys.stderr, ) + print( + "\n💡 Try `mise run fix` to auto-fix lint issues, then re-run `mise run lint` to verify.", + file=sys.stderr, + ) sys.exit(1) else: committed_data = json.loads(COMMITTED.read_text()) @@ -163,6 +167,10 @@ def normalize(d): "Run 'mise run lint:renovate-deps' with AUTOFIX=true to update.", file=sys.stderr, ) + print( + "\n💡 Try `mise run fix` to auto-fix lint issues, then re-run `mise run lint` to verify.", + file=sys.stderr, + ) sys.exit(1) diff --git a/tasks/lint/super-linter.sh b/tasks/lint/super-linter.sh index 6793005..d93dbcc 100755 --- a/tasks/lint/super-linter.sh +++ b/tasks/lint/super-linter.sh @@ -10,6 +10,21 @@ if [ "${usage_autofix:-}" = "true" ]; then AUTOFIX=true fi +_LINTER_RAN=false + +_on_exit() { + local ec=$? + if [ -n "${_FILTERED_ENV_FILE:-}" ]; then + rm -f -- "$_FILTERED_ENV_FILE" + fi + if [ $ec -ne 0 ] && [ "$_LINTER_RAN" = "true" ] && [ "${AUTOFIX:-}" != "true" ]; then + # shellcheck disable=SC2016 # backticks are intentional: literal formatting, not command substitution + printf '\n💡 Try `mise run fix` to auto-fix lint issues, then re-run `mise run lint` to verify.\n' + fi + exit $ec +} +trap _on_exit EXIT + # check for required env vars, otherwise exit with error if [ -z "${SUPER_LINTER_VERSION:-}" ]; then echo "SUPER_LINTER_VERSION environment variable is not set. Exiting." @@ -40,14 +55,14 @@ fi ENV_FILE="${SUPER_LINTER_ENV_FILE:-.github/config/super-linter.env}" if [ "${AUTOFIX:-}" != "true" ]; then # Filter out FIX_* and comment lines when not auto-fixing - FILTERED_ENV_FILE=$(mktemp) - trap 'rm -f "$FILTERED_ENV_FILE"' EXIT - grep -v '^#' "$ENV_FILE" | grep -v '^FIX_' >"$FILTERED_ENV_FILE" - ENV_FILE="$FILTERED_ENV_FILE" + _FILTERED_ENV_FILE=$(mktemp) + grep -v '^#' "$ENV_FILE" | grep -v '^FIX_' >"$_FILTERED_ENV_FILE" + ENV_FILE="$_FILTERED_ENV_FILE" fi $RUNTIME image pull -q --platform linux/amd64 "ghcr.io/super-linter/super-linter:${SUPER_LINTER_VERSION}" >/dev/null +_LINTER_RAN=true $RUNTIME container run --rm --platform linux/amd64 \ -e RUN_LOCAL=true \ -e DEFAULT_BRANCH=main \