#!/bin/bash # ============================================================================= # scripts/dev/lint.sh # # Local developer entry point mirroring .github/workflows/lint.yml: runs # ShellCheck over shell scripts/SlackBuilds and xmllint over plugin/podman.plg. # Requires `shellcheck` and `xmllint` (libxml2) to be installed locally. # ============================================================================= set -eu REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" cd "$REPO_ROOT" status=0 if command -v shellcheck > /dev/null 2>&1; then echo "==> ShellCheck" find plugin/rc.d plugin/sbin scripts -type f \ \( -name '*.sh' -o -name 'rc.*' -o -name '*.SlackBuild' \) \ -print0 \ | xargs -0 shellcheck --severity=warning --external-sources || status=1 else echo "!! shellcheck not installed, skipping (install it to match CI: https://www.shellcheck.net/)" >&2 fi if command -v xmllint > /dev/null 2>&1; then echo "==> xmllint (plugin/podman.plg)" xmllint --noout plugin/podman.plg || status=1 else echo "!! xmllint not installed, skipping (part of libxml2-utils)" >&2 fi exit "$status"