Skip to content

Commit

Permalink
Merge pull request #7 from thundergolfer/jonathon/make-integration-le…
Browse files Browse the repository at this point in the history
…ss-noisy

Make integration less noisy
  • Loading branch information
Jonathon Belotti committed Jan 17, 2020
2 parents 2c34bcc + e1a8e7f commit 4932c72
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions templates/mypy.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,26 @@ set -o nounset
set -o pipefail

main() {
local output="{OUTPUT}"
local output
local report_file
local status
report_file="{OUTPUT}"

# TODO(Jonathon): Consider UX improvements using https://mypy.readthedocs.io/en/stable/command_line.html#configuring-error-messages

export MYPYPATH="$(pwd):{MYPYPATH_PATH}"

echo "MYPYPATH: ${MYPYPATH}"
set +o errexit
output=$({MYPY_EXE} {VERBOSE_OPT} --bazel --package-root . --config-file {MYPY_INI_PATH} --cache-map {CACHE_MAP_TRIPLES} -- {SRCS} 2>&1)
status=$?
set -o errexit

echo "${output}" > "${report_file}"
if [[ $status -ne 0 ]]; then
echo "${output}" # Show MyPy's error to end-user via Bazel's console logging
exit 1
fi

{MYPY_EXE} {VERBOSE_OPT} \
--bazel \
--package-root . \
--config-file {MYPY_INI_PATH} \
--cache-map {CACHE_MAP_TRIPLES} -- {SRCS} 2>&1 | tee "${output}"
}

main "$@"

0 comments on commit 4932c72

Please sign in to comment.