Skip to content

Commit

Permalink
Print warnings with the right color code
Browse files Browse the repository at this point in the history
  • Loading branch information
urjitbhatia committed May 4, 2020
1 parent 5ac9be3 commit 8cdf383
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/colors
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ else
# Colors
# NOTE: Your editor may NOT show the 0x1b / escape character left of the '['
NORMAL=""
WARNING="[1;33m" # Bad (red)
WARNING="[0;33m" # Warning (brown)
SECTION="" # Section (yellow)
NOTICE="" # Notice (yellow)
OK="" # Ok (green)
Expand All @@ -68,6 +68,6 @@ fi
printColorsCode(){
if [[ $MONOCHROME -eq 0 ]]; then
echo -e "\n$NORMAL Colors code for results: "
echo -e "$NOTICE INFO (Information)$NORMAL,$OK PASS (Recommended value)$NORMAL, $BAD WARNING (Ignored by whitelist)$NORMAL, $BAD FAIL (Fix required)$NORMAL, $PURPLE Not Scored $NORMAL"
echo -e "$NOTICE INFO (Information)$NORMAL,$OK PASS (Recommended value)$NORMAL, $WARNING WARNING (Ignored by whitelist)$NORMAL, $BAD FAIL (Fix required)$NORMAL, $PURPLE Not Scored $NORMAL"
fi
}
6 changes: 4 additions & 2 deletions include/outputs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ textInfo(){
textFail(){
## ignore whitelists for current check
level="FAIL"
colorcode="$BAD"
for i in $IGNORES; do
ignore_check_name="${i%:*}"
ignore_value="${i#*${CHECK_NAME}:}"
Expand All @@ -95,6 +96,7 @@ textFail(){
fi
if [[ $1 =~ ${ignore_value} ]]; then
level="WARNING"
colorcode="$WARNING"
break
fi
done
Expand Down Expand Up @@ -128,10 +130,10 @@ textFail(){
output_junit_failure "$1"
fi
if [[ "${MODES[@]}" =~ "mono" ]]; then
echo " $BAD ${level}! $1 $NORMAL" | tee -a ${OUTPUT_FILE_NAME}.$EXTENSION_TEXT
echo " $colorcode ${level}! $1 $NORMAL" | tee -a ${OUTPUT_FILE_NAME}.$EXTENSION_TEXT
fi
if [[ "${MODES[@]}" =~ "text" ]]; then
echo " $BAD ${level}! $1 $NORMAL"
echo " $colorcode ${level}! $1 $NORMAL"
fi
}

Expand Down

0 comments on commit 8cdf383

Please sign in to comment.