Thinking of classical programming languages, many compilers support error levels. Error levels let one specify the severity at which the compile process halts. This is very handy. Once a project comes to an end, I typically enable a very pedantic error level, such that I can make sure that what I contribute is really free of all errors.
I am wondering is there something similar for Latex? To give an example, I would find it desirable if there was a flag that halts compilation on undefined references, rather than having to forge my entire document for ???.
Note
I ended up using the accepted answer. Since references aren't present on the first run, I added a \pedantic flag to my Makefile.
$(FILE)_pedantic.pdf: *.tex
pdflatex -synctex=1 -shell-escape "\def\pedantic{0} \input{$(FILE).tex}"
pdflatex -synctex=1 -shell-escape "\def\pedantic{0} \input{$(FILE).tex}"
bibtex $(FILE)
makeglossaries $(FILE)
pdflatex -synctex=1 -shell-escape "\def\pedantic{0} \input{$(FILE).tex}"
pdflatex -synctex=1 -shell-escape "\def\pedantic{1} \input{$(FILE).tex}"
My root.tex file then sets
\if\pedantic1
\MakeWarningsErrors
\fi
as suggested by the author of the accepted answer.