Files
sendico/ci/scripts/common/run_backend_lint.sh
Stephan D 918dbe8bb5
Some checks failed
ci/woodpecker/push/fx_oracle Pipeline is pending
ci/woodpecker/push/gateway_mntx Pipeline is pending
ci/woodpecker/push/gateway_tron Pipeline is pending
ci/woodpecker/push/ledger Pipeline is pending
ci/woodpecker/push/payments_methods Pipeline is pending
ci/woodpecker/push/payments_orchestrator Pipeline is pending
ci/woodpecker/push/payments_quotation Pipeline is pending
ci/woodpecker/push/gateway_chain Pipeline is pending
ci/woodpecker/push/gateway_tgsettle Pipeline is pending
ci/woodpecker/push/notification Pipeline is pending
ci/woodpecker/push/billing_documents Pipeline failed
ci/woodpecker/push/callbacks Pipeline failed
ci/woodpecker/push/discovery Pipeline failed
ci/woodpecker/push/bff Pipeline failed
ci/woodpecker/push/frontend Pipeline failed
ci/woodpecker/push/billing_fees Pipeline failed
ci/woodpecker/push/fx_ingestor Pipeline failed
linting added to CI + bypass tags
2026-03-10 12:39:30 +01:00

57 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env sh
set -eu
if ! set -o pipefail 2>/dev/null; then
:
fi
SERVICE="${1:-}"
if [ -z "${SERVICE}" ]; then
echo "usage: $0 <service-key>" >&2
exit 2
fi
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/../../.." && pwd)"
cd "${REPO_ROOT}"
if bypass_reason="$(sh "${SCRIPT_DIR}/should_bypass_backend_check.sh" "${SERVICE}" lint)"; then
echo "[backend-lint] ${bypass_reason}"
exit 0
fi
if ! command -v golangci-lint >/dev/null 2>&1; then
echo "[backend-lint] golangci-lint is required in PATH" >&2
exit 1
fi
# shellcheck source=ci/scripts/common/backend_modules.sh
. "${SCRIPT_DIR}/backend_modules.sh"
if ! modules="$(backend_service_modules "${SERVICE}")"; then
echo "[backend-lint] unknown service key: ${SERVICE}" >&2
exit 2
fi
run_go_lint() {
module="$1"
if [ ! -f "${module}/go.mod" ]; then
echo "[backend-lint] missing go.mod for module: ${module}" >&2
exit 1
fi
if [ ! -f "${module}/.golangci.yml" ]; then
echo "[backend-lint] missing .golangci.yml for module: ${module}" >&2
exit 1
fi
echo "[backend-lint] running golangci-lint in ${module}"
(
cd "${module}"
golangci-lint run --timeout=10m ./...
)
}
for module in ${modules}; do
run_go_lint "${module}"
done