#!/usr/bin/env bash # Vérifie la forme des scénarios d'utilisation (docs/scenarios/, ADR 0008) : # un titre « Fonctionnalité », au moins un « Scénario », des étapes qui # commencent par un mot-clé Gherkin français, chaque fichier dans l'index. set -euo pipefail cd "$(dirname "$0")/../docs/scenarios" errors=0 report() { echo "$1" errors=$((errors + 1)) } for f in *.feature.md; do head -n1 "$f" | grep -qE '^# Fonctionnalité : .+' \ || report "$f : la première ligne doit être « # Fonctionnalité : … »" grep -qE '^## Scénario : .+' "$f" || report "$f : aucun « ## Scénario : … »" while IFS= read -r step; do report "$f : étape sans mot-clé Gherkin : $step" done < <(grep -E '^\* ' "$f" | grep -vE '^\* (Étant donné|Quand|Alors|Et|Mais) ' || true) grep -qF "]($f)" README.md || report "$f : absent de l'index README.md" done [ "$errors" -eq 0 ]