From 38251abe26d952e4602d819c74fcdba46af4b066 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Thu, 7 Oct 2021 17:14:41 -0700 Subject: [PATCH] Add suggestion level in text for TTY output (fixes #2339) --- CHANGELOG.md | 1 + src/ShellCheck/Formatter/TTY.hs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7be144..1741552 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ - SC2181 now only triggers on single condition tests like `[ $? = 0 ]`. - Quote warnings are now emitted for declaration utilities in sh - Leading `_` can now be used to suppress warnings about unused variables +- TTY output now includes warning level in text as well as color ### Removed - SC1004: Literal backslash+linefeed in '' was found to be usually correct diff --git a/src/ShellCheck/Formatter/TTY.hs b/src/ShellCheck/Formatter/TTY.hs index bb57894..8dd90d4 100644 --- a/src/ShellCheck/Formatter/TTY.hs +++ b/src/ShellCheck/Formatter/TTY.hs @@ -174,7 +174,7 @@ showFixedString color comments lineNum fileLines = cuteIndent :: PositionedComment -> String cuteIndent comment = replicate (fromIntegral $ colNo comment - 1) ' ' ++ - makeArrow ++ " " ++ code (codeNo comment) ++ ": " ++ messageText comment + makeArrow ++ " " ++ code (codeNo comment) ++ " (" ++ severityText comment ++ "): " ++ messageText comment where arrow n = '^' : replicate (fromIntegral $ n-2) '-' ++ "^" makeArrow =