mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 21:21:48 +03:00
fix(errors): align errorKindToString with SARIF level values
Signed-off-by: royalpinto007 <royalpinto007@gmail.com>
This commit is contained in:
parent
dc5f8db05c
commit
33cd3b3981
3 changed files with 13 additions and 13 deletions
|
@ -178,22 +178,22 @@ string formatErrorMessage(const(char)* format, va_list ap) nothrow {
|
|||
}
|
||||
|
||||
/**
|
||||
Converts an `ErrorKind` value to a string representation.
|
||||
Converts an `ErrorKind` value to a SARIF-compatible string representation for the severity level.
|
||||
|
||||
Params:
|
||||
kind = The `ErrorKind` value to convert (e.g., error, warning, deprecation).
|
||||
|
||||
Returns:
|
||||
A string representing the `ErrorKind` value, such as "Error" or "Warning".
|
||||
A SARIF-compatible string representing the `ErrorKind` level, such as "error" or "warning".
|
||||
*/
|
||||
string errorKindToString(ErrorKind kind) nothrow
|
||||
{
|
||||
final switch (kind) {
|
||||
case ErrorKind.error: return "Error";
|
||||
case ErrorKind.warning: return "Warning";
|
||||
case ErrorKind.deprecation: return "Deprecation";
|
||||
case ErrorKind.tip: return "Tip";
|
||||
case ErrorKind.message: return "Message";
|
||||
case ErrorKind.error: return "error"; // Serious problem
|
||||
case ErrorKind.warning: return "warning"; // Problem found
|
||||
case ErrorKind.deprecation: return "note"; // Minor problem, opportunity for improvement
|
||||
case ErrorKind.tip: return "note"; // Minor improvement suggestion
|
||||
case ErrorKind.message: return "none"; // Not applicable for "fail" kind, so use "none"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,11 +18,11 @@ TEST_OUTPUT:
|
|||
}],
|
||||
"results": [
|
||||
{
|
||||
"ruleId": "DMD-Error",
|
||||
"ruleId": "DMD-error",
|
||||
"message": {
|
||||
"text": "undefined identifier `x`"
|
||||
},
|
||||
"level": "Error",
|
||||
"level": "error",
|
||||
"locations": [{
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
|
|
|
@ -18,11 +18,11 @@ TEST_OUTPUT:
|
|||
}],
|
||||
"results": [
|
||||
{
|
||||
"ruleId": "DMD-Error",
|
||||
"ruleId": "DMD-error",
|
||||
"message": {
|
||||
"text": "undefined identifier `x`"
|
||||
},
|
||||
"level": "Error",
|
||||
"level": "error",
|
||||
"locations": [{
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
|
@ -36,11 +36,11 @@ TEST_OUTPUT:
|
|||
}]
|
||||
},
|
||||
{
|
||||
"ruleId": "DMD-Error",
|
||||
"ruleId": "DMD-error",
|
||||
"message": {
|
||||
"text": "undefined identifier `y`"
|
||||
},
|
||||
"level": "Error",
|
||||
"level": "error",
|
||||
"locations": [{
|
||||
"physicalLocation": {
|
||||
"artifactLocation": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue