mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-12 20:10:01 -05:00
Enable ansible linter in TAP format
This commit is contained in:
parent
ddbc96bd23
commit
40687fc6db
1 changed files with 43 additions and 1 deletions
|
@ -497,6 +497,16 @@ LintAnsibleFiles()
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
####################################
|
||||||
|
# Prepare context if OUTPUT_FORMAT #
|
||||||
|
####################################
|
||||||
|
if [ -n "${OUTPUT_FORMAT}" ] ; then
|
||||||
|
TMPFILE=$(mktemp -q "/tmp/super-linter-${FILE_TYPE}.XXXXXX")
|
||||||
|
INDEX=0
|
||||||
|
mkdir -p "${REPORT_OUTPUT_FOLDER}"
|
||||||
|
REPORT_OUTPUT_FILE="${REPORT_OUTPUT_FOLDER}/super-linter-${FILE_TYPE}.${OUTPUT_FORMAT}"
|
||||||
|
fi
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Lint the files #
|
# Lint the files #
|
||||||
##################
|
##################
|
||||||
|
@ -511,6 +521,11 @@ LintAnsibleFiles()
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
##################################
|
||||||
|
# Increase the linted file index #
|
||||||
|
##################################
|
||||||
|
(("INDEX++"))
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# Get the filename #
|
# Get the filename #
|
||||||
####################
|
####################
|
||||||
|
@ -543,13 +558,37 @@ LintAnsibleFiles()
|
||||||
echo "ERROR:[$LINT_CMD]"
|
echo "ERROR:[$LINT_CMD]"
|
||||||
# Increment error count
|
# Increment error count
|
||||||
((ERRORS_FOUND_ANSIBLE++))
|
((ERRORS_FOUND_ANSIBLE++))
|
||||||
|
|
||||||
|
#######################################################
|
||||||
|
# Store the linting as a temporary file in TAP format #
|
||||||
|
#######################################################
|
||||||
|
if [ -n "${OUTPUT_FORMAT}" ] ; then
|
||||||
|
echo "nok ok ${INDEX} - ${FILE}" >> "${TMPFILE}"
|
||||||
|
echo " ERROR:[$LINT_CMD]" >> "${TMPFILE}"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
###########
|
###########
|
||||||
# Success #
|
# Success #
|
||||||
###########
|
###########
|
||||||
echo " - File:[$FILE_NAME] was linted with [$LINTER_NAME] successfully"
|
echo " - File:[$FILE_NAME] was linted with [$LINTER_NAME] successfully"
|
||||||
|
|
||||||
|
#######################################################
|
||||||
|
# Store the linting as a temporary file in TAP format #
|
||||||
|
#######################################################
|
||||||
|
if [ -n "${OUTPUT_FORMAT}" ] ; then
|
||||||
|
echo "ok ${INDEX} - ${FILE}" >> "${TMPFILE}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
#################################
|
||||||
|
# Generate report in TAP format #
|
||||||
|
#################################
|
||||||
|
if [ -n "${OUTPUT_FORMAT}" ] && [ ${INDEX} -gt 0 ] ; then
|
||||||
|
echo "1..${INDEX}" > "${REPORT_OUTPUT_FILE}"
|
||||||
|
cat "${TMPFILE}" >> "${REPORT_OUTPUT_FILE}"
|
||||||
|
fi
|
||||||
|
|
||||||
else # No ansible directory found in path
|
else # No ansible directory found in path
|
||||||
###############################
|
###############################
|
||||||
# Check to see if debug is on #
|
# Check to see if debug is on #
|
||||||
|
@ -1793,7 +1832,7 @@ LintCodebase()
|
||||||
# Prepare context if OUTPUT_FORMAT #
|
# Prepare context if OUTPUT_FORMAT #
|
||||||
####################################
|
####################################
|
||||||
if [ -n "${OUTPUT_FORMAT}" ] ; then
|
if [ -n "${OUTPUT_FORMAT}" ] ; then
|
||||||
TMPFILE=$(mktemp -q /tmp/super-linter.XXXXXX)
|
TMPFILE=$(mktemp -q "/tmp/super-linter-${FILE_TYPE}.XXXXXX")
|
||||||
INDEX=0
|
INDEX=0
|
||||||
mkdir -p "${REPORT_OUTPUT_FOLDER}"
|
mkdir -p "${REPORT_OUTPUT_FOLDER}"
|
||||||
REPORT_OUTPUT_FILE="${REPORT_OUTPUT_FOLDER}/super-linter-${FILE_TYPE}.${OUTPUT_FORMAT}"
|
REPORT_OUTPUT_FILE="${REPORT_OUTPUT_FOLDER}/super-linter-${FILE_TYPE}.${OUTPUT_FORMAT}"
|
||||||
|
@ -1820,6 +1859,9 @@ LintCodebase()
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
##################################
|
||||||
|
# Increase the linted file index #
|
||||||
|
##################################
|
||||||
(("INDEX++"))
|
(("INDEX++"))
|
||||||
|
|
||||||
##############
|
##############
|
||||||
|
|
Loading…
Reference in a new issue