refactored AddDetailedMessageIfEnabled

This commit is contained in:
Victor Martinez 2020-07-15 22:37:46 +01:00
parent 759b5bac1f
commit cee9d3a956
No known key found for this signature in database
GPG key ID: 4058B656AD58C4F5

View file

@ -220,13 +220,7 @@ function LintCodebase() {
####################################################### #######################################################
if IsTAP ; then if IsTAP ; then
NotOkTap "${INDEX}" "${FILE}" "${TMPFILE}" NotOkTap "${INDEX}" "${FILE}" "${TMPFILE}"
########################################## AddDetailedMessageIfEnabled "$LINT_CMD" "${TMPFILE}"
# Report the detailed message if enabled #
##########################################
DETAILED_MSG=$(TransformTAPDetails "$LINT_CMD")
if [ -n "${DETAILED_MSG}" ] ; then
printf " ---\n message: %s\n ...\n" "$DETAILED_MSG" >> "${TMPFILE}"
fi
fi fi
else else
########### ###########
@ -476,13 +470,7 @@ function TestCodebase() {
####################################################### #######################################################
if IsTAP ; then if IsTAP ; then
NotOkTap "${TESTS_RAN}" "${FILE_NAME}" "${TMPFILE}" NotOkTap "${TESTS_RAN}" "${FILE_NAME}" "${TMPFILE}"
########################################## AddDetailedMessageIfEnabled "$LINT_CMD" "${TMPFILE}"
# Report the detailed message if enabled #
##########################################
DETAILED_MSG=$(TransformTAPDetails "$LINT_CMD")
if [ -n "${DETAILED_MSG}" ] ; then
printf " ---\n message: %s\n ...\n" "${DETAILED_MSG}" >> "${TMPFILE}"
fi
fi fi
fi fi
done done
@ -760,13 +748,7 @@ function LintAnsibleFiles() {
####################################################### #######################################################
if IsTAP ; then if IsTAP ; then
NotOkTap "${INDEX}" "${FILE}" "${TMPFILE}" NotOkTap "${INDEX}" "${FILE}" "${TMPFILE}"
########################################## AddDetailedMessageIfEnabled "${LINT_CMD}" "${TMPFILE}"
# Report the detailed message if enabled #
##########################################
DETAILED_MSG=$(TransformTAPDetails "$LINT_CMD")
if [ -n "${DETAILED_MSG}" ] ; then
printf " ---\n message: %s\n ...\n" "$DETAILED_MSG" >> "${TMPFILE}"
fi
fi fi
else else
@ -839,3 +821,11 @@ function OkTap() {
function NotOkTap() { function NotOkTap() {
echo "not ok ${1} - ${2}" >> "${3}" echo "not ok ${1} - ${2}" >> "${3}"
} }
################################################################################
#### Function AddDetailedMessageIfEnabled ######################################
function AddDetailedMessageIfEnabled() {
DETAILED_MSG=$(TransformTAPDetails "${1}")
if [ -n "${DETAILED_MSG}" ] ; then
printf " ---\n message: %s\n ...\n" "$DETAILED_MSG" >> "${2}"
fi
}