-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix severity colorization #6608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Thanks for your contribution. Please add a unit tests for this. |
@@ -1394,7 +1394,7 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a | |||
|
|||
// Default template format.. | |||
if (mSettings.templateFormat.empty()) { | |||
mSettings.templateFormat = "{bold}{file}:{line}:{column}: {red}{inconclusive:{magenta}}{severity}:{inconclusive: inconclusive:}{default} {message} [{id}]{reset}\\n{code}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This removes the downgrade of red
to magenta
for inconclusive findings.
lib/errorlogger.cpp
Outdated
@@ -637,7 +637,9 @@ std::string ErrorMessage::toString(bool verbose, const std::string &templateForm | |||
findAndReplace(result, replaceFrom, replaceWith); | |||
pos1 = result.find("{inconclusive:", pos1); | |||
} | |||
findAndReplace(result, "{severity}", severityToString(severity)); | |||
std::string sseverity = coloredSeverityToString(severity); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would introduce coloring even if it has been disabled. If you provide a custom template you need to provide the colors yourself.
It seems like this is actually a missing feature being able to specify colored severities. So this probably needs to be a separate macro.
13568d7
to
8df610d
Compare
Added now unit-tests, but there's still the issue with custom templates, and magenta for inconclusive downgrade. |
void ErrorMessageColorized() const { | ||
const bool oDisableColors = gDisableColors; | ||
gDisableColors = false; | ||
setenv("CLICOLOR_FORCE", "1", 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Since it requires you to modify the environment this should be implemented as a Python test instead. This should probably live next to the ones added when CLICOLOR_FORCE
was introduced.
c4441cf
to
0944fd0
Compare
0944fd0
to
4d61d3c
Compare
4d61d3c
to
e88e91b
Compare
esp. information as red was disturbing.
e88e91b
to
1459984
Compare
|
esp. information as red was disturbing