#!/bin/bash # checks.sh - Run all quality checks on conflict-buttons.el # Usage: ./checks.sh set -e # Exit on error echo "=== CONFLICT-BUTTONS.EL QUALITY CHECKS ===" echo "" # Track overall status OVERALL_STATUS=0 # 1. Run checkdoc echo "[1/5] Running checkdoc..." echo " Checking conflict-buttons.el..." if emacs --batch --eval "(progn (require 'checkdoc) (checkdoc-file \"conflict-buttons.el\"))" 2>&1 | grep -i "error\|warning"; then echo " ⚠ Checkdoc found issues" OVERALL_STATUS=1 else echo " ✓ Checkdoc completed successfully" fi echo "" # 2. Run package-lint echo "[2/5] Running package-lint..." echo " Linting conflict-buttons.el..." if emacs --batch \ --eval "(require 'package)" \ --eval "(add-to-list 'package-archives '(\"melpa\" . \"https://melpa.org/packages/\") t)" \ --eval "(package-initialize)" \ --eval "(unless (package-installed-p 'package-lint) (package-refresh-contents) (package-install 'package-lint))" \ --eval "(require 'package-lint)" \ -f package-lint-batch-and-exit conflict-buttons.el 2>&1 | grep -i "error\|warning"; then echo " ⚠ Package-lint found issues" OVERALL_STATUS=1 else echo " ✓ Package-lint completed successfully" fi echo "" # 3. Run melpazoid echo "[3/5] Running melpazoid..." if command -v docker >/dev/null 2>&1 && command -v python3 >/dev/null 2>&1; then if [ ! -d "melpazoid" ]; then echo " Cloning melpazoid..." git clone https://github.com/riscy/melpazoid.git 2>&1 | grep -v "Cloning" || true fi echo " Running melpazoid checks with MELPA recipe..." RECIPE='(conflict-buttons :fetcher git :url "https://git.andros.dev/andros/conflict-buttons.el")' # Use LOCAL_REPO to test local files instead of cloning if RECIPE="$RECIPE" LOCAL_REPO="$(pwd)" make -C melpazoid 2>&1; then echo " ✓ Melpazoid completed" else echo " ⚠ Melpazoid had warnings or errors" OVERALL_STATUS=1 fi else if ! command -v docker >/dev/null 2>&1; then echo " ⚠ docker not found, skipping melpazoid" elif ! command -v python3 >/dev/null 2>&1; then echo " ⚠ python3 not found, skipping melpazoid" fi fi echo "" # 4. Format the file echo "[4/5] Formatting conflict-buttons.el..." if emacs --batch conflict-buttons.el --eval "(progn (emacs-lisp-mode) (indent-region (point-min) (point-max)) (save-buffer))" 2>&1 | grep -q "error"; then echo " ✗ Failed to format conflict-buttons.el" OVERALL_STATUS=1 else echo " ✓ Formatted conflict-buttons.el" fi echo "" # 5. Compile the file echo "[5/5] Compiling conflict-buttons.el..." if emacs --batch --eval "(setq byte-compile-error-on-warn t)" -f batch-byte-compile conflict-buttons.el 2>&1 | grep -i "error\|warning" | grep -v "Loading"; then echo " ⚠ Compilation warnings/errors found" OVERALL_STATUS=1 else echo " ✓ Compiled successfully" fi echo "" echo "=== ALL CHECKS COMPLETED ===" if [ $OVERALL_STATUS -eq 0 ]; then echo "✓ All checks passed!" else echo "✗ Some checks failed or had warnings" fi exit $OVERALL_STATUS