#!/bin/bash -e

CRI=(podman)

REPORTS="$(mktemp -d)"
LOGS="$REPORTS/coding-style-reports.log"

"${CRI[@]}" run --rm                            \
    -v "$PWD:/mnt/delivery"                     \
    -v "$REPORTS:/mnt/reports"                  \
    ghcr.io/epitech/coding-style-checker:latest \
    /mnt/delivery /mnt/reports

cat "$LOGS"
echo "$(grep -c ': MAJOR:' "$LOGS") major, $(grep -c ': MINOR:' "$LOGS") minor, $(grep -c ': INFO:'  "$LOGS") info coding style error(s) reported in $LOGS"
