Skip to content

Conversation

rurban
Copy link

@rurban rurban commented Jul 17, 2024

esp. information as red was disturbing

@firewave
Copy link
Collaborator

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}";
Copy link
Collaborator

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.

@@ -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);
Copy link
Collaborator

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.

@rurban rurban force-pushed the coloredSeverityToString branch from 13568d7 to 8df610d Compare July 18, 2024 16:54
@rurban
Copy link
Author

rurban commented Jul 18, 2024

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);
Copy link
Collaborator

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.

@firewave firewave marked this pull request as draft August 31, 2024 13:01
@rurban rurban force-pushed the coloredSeverityToString branch 3 times, most recently from c4441cf to 0944fd0 Compare April 17, 2025 12:28
@rurban rurban force-pushed the coloredSeverityToString branch from 0944fd0 to 4d61d3c Compare May 3, 2025 03:58
@rurban rurban force-pushed the coloredSeverityToString branch from 4d61d3c to e88e91b Compare July 28, 2025 12:35
esp. information as red was disturbing.
@rurban rurban force-pushed the coloredSeverityToString branch from e88e91b to 1459984 Compare July 28, 2025 13:01
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants