#!/bin/sh
# script/lint: run the linter. Linting only ever happens inside the
# image built from Dockerfile.lint, which pins the linter by hash, so
# the answer is the same on every machine and in CI. The linter runs as
# a build step of that image, so a complaint fails the build and no
# container is left behind.
set -eu

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)"
ROOT="$(cd "$SCRIPT_DIR/.." && pwd -P)"

main() {
    cd "$ROOT"
    docker build --progress=plain -f Dockerfile.lint \
        -t "$("$SCRIPT_DIR/projectname")-lint" .
}

main "$@"
