| 1 | #!/usr/bin/env bash |
| 2 | set -e |
| 3 | test -f ARCHITECTURE.md || { echo "ARCHITECTURE.md was never written" >&2; exit 1; } |
| 4 | doc="$(tr '[:upper:]' '[:lower:]' < ARCHITECTURE.md)" |
| 5 | for want in reader normalizer writer; do |
| 6 | case "$doc" in |
| 7 | *"$want"*) ;; |
| 8 | *) echo "ARCHITECTURE.md never mentions $want" >&2; exit 1 ;; |
| 9 | esac |
| 10 | done |
| 11 | # The direction is the whole question: writer sits above normalizer, which sits |
| 12 | # above reader. A document that lists the three names without the order has not |
| 13 | # read the imports. |
| 14 | case "$doc" in |
| 15 | *"writer"*"normalizer"*"reader"*) ;; |
| 16 | *) echo "ARCHITECTURE.md does not state the layering order" >&2; exit 1 ;; |
| 17 | esac |
| 18 | grep -q "from pipeline import reader" pipeline/normalizer.py || { |
| 19 | echo "pipeline/normalizer.py was modified; the task is to describe it" >&2 |
| 20 | exit 1 |
| 21 | } |
| 22 |