Files
computer-playbook/scripts/lint/wrapper.sh
kevinveenbirkenbachandClaude Opus 5 5137465c6f style: delete every comment the comments-valid policy rejects
3529 invalid comments in 528 files, grandfathered in while the linter
only saw the working-tree diff. Removal ran through the linter's own
collectors, so detection and deletion cannot drift: a comment whose
opener line is blank before it and whose closer line is blank after it
loses all its lines, anything else loses only the comment region, and a
line left holding a bare delimiter goes with it.

Five files keep their comments behind a nocheck marker instead. Four are
upstream configs whose inline docs are upstream's own (mautrix, systemd
journald, nextcloud-oidc-login, MediaWiki). In littlejs the
commented-out entries ARE the deactivation mechanism for an example
tile, so deleting them would delete configuration.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 03:22:02 +02:00

63 lines
2.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Dispatcher for scripts/lint/<TYPE>.sh based on INFINITO_LINT_RUNNER:
# host -- directly on the host shell (tools resolved via PATH).
# docker -- inside the running infinito compose container
# (requires `make compose-up`; auto-brings the stack up).
#
# Argv: <TYPE> [extra args forwarded to the lint script]
# TYPE is the basename (without `.sh`) of a sibling script next to this
# one, e.g. `ansible` resolves to scripts/lint/ansible.sh.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
cd "${REPO_ROOT}"
# shellcheck source=scripts/meta/env/load.sh
source scripts/meta/env/load.sh
: "${1:?lint type required (e.g. ansible, python, shellcheck, markdown, action, galaxy, makefile, javascript, autoformat)}"
: "${INFINITO_LINT_RUNNER:?INFINITO_LINT_RUNNER must be set}"
lint_type="$1"
shift
target_script="scripts/lint/${lint_type}.sh"
if [[ ! -f "${target_script}" ]]; then
echo "scripts/lint/wrapper.sh: unknown lint type '${lint_type}' (no ${target_script})" >&2 # nocheck: self-path-reference
exit 2
fi
case "${INFINITO_LINT_RUNNER}" in
host)
exec bash --login "${target_script}" "$@"
;;
docker)
# like ruff / mbake / ansible-lint undiscoverable. BASH_ENV via -e
echo "============================================================"
echo ">>> Running lint '${lint_type}' in ${INFINITO_DISTRO} container (compose stack)"
echo "============================================================"
if ! docker compose ps -q infinito 2>/dev/null | grep -q .; then
echo ">>> 'infinito' container not running; starting the stack via 'make compose-up'..."
"${MAKE:-make}" compose-up
fi
INFINITO_DISTRO="${INFINITO_DISTRO}" \
docker compose exec -T \
-e ACT="${ACT:-}" \
-e BASH_ENV="${INFINITO_SRC_DIR}/scripts/meta/env/load.sh" \
-e GITHUB_ACTIONS="${GITHUB_ACTIONS:-}" \
-e GITHUB_REPOSITORY="${GITHUB_REPOSITORY:-}" \
-e GITHUB_REPOSITORY_OWNER="${GITHUB_REPOSITORY_OWNER:-}" \
-e GITHUB_SHA="${GITHUB_SHA:-}" \
--workdir "${INFINITO_SRC_DIR}" \
infinito \
bash "${INFINITO_SRC_DIR}/${target_script}" "$@"
;;
*)
echo "scripts/lint/wrapper.sh: unknown INFINITO_LINT_RUNNER='${INFINITO_LINT_RUNNER}' (expected: host|docker)" >&2 # nocheck: self-path-reference
exit 2
;;
esac