Skip to content

Commit d8a2a67

Browse files
author
Kapil Borle
committed
Add SuggestdCorrection property to DiagnosticRecord
1 parent 6b51b94 commit d8a2a67

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

Engine/Generic/DiagnosticRecord.cs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class DiagnosticRecord
2626
private DiagnosticSeverity severity;
2727
private string scriptName;
2828
private string ruleSuppressionId;
29+
private string suggestedCorrection;
2930

3031
/// <summary>
3132
/// Represents a string from the rule about why this diagnostic was created.
@@ -91,30 +92,41 @@ public string RuleSuppressionID
9192
set { ruleSuppressionId = value; }
9293
}
9394

95+
/// <summary>
96+
/// Returns suggested correction
97+
/// return value can be null
98+
/// </summary>
99+
public string SuggestedCorrection
100+
{
101+
get { return suggestedCorrection; }
102+
}
103+
94104
/// <summary>
95105
/// DiagnosticRecord: The constructor for DiagnosticRecord class.
96106
/// </summary>
97107
public DiagnosticRecord()
98108
{
99109

100110
}
101-
111+
102112
/// <summary>
103-
/// DiagnosticRecord: The constructor for DiagnosticRecord class.
113+
/// DiagnosticRecord: The constructor for DiagnosticRecord class that takes in suggestedCorrection
104114
/// </summary>
105115
/// <param name="message">A string about why this diagnostic was created</param>
106116
/// <param name="extent">The place in the script this diagnostic refers to</param>
107117
/// <param name="ruleName">The name of the rule that created this diagnostic</param>
108118
/// <param name="severity">The severity of this diagnostic</param>
109119
/// <param name="scriptName">The name of the script file being analyzed</param>
110-
public DiagnosticRecord(string message, IScriptExtent extent, string ruleName, DiagnosticSeverity severity, string scriptName, string ruleId = null)
120+
/// <param name="suggestedCorrection">The correction suggested by the rule to replace the extent text</param>
121+
public DiagnosticRecord(string message, IScriptExtent extent, string ruleName, DiagnosticSeverity severity, string scriptName, string ruleId = null, string suggestedCorrection = null)
111122
{
112-
Message = string.IsNullOrEmpty(message) ? string.Empty : message;
123+
Message = string.IsNullOrEmpty(message) ? string.Empty : message;
113124
RuleName = string.IsNullOrEmpty(ruleName) ? string.Empty : ruleName;
114-
Extent = extent;
125+
Extent = extent;
115126
Severity = severity;
116127
ScriptName = string.IsNullOrEmpty(scriptName) ? string.Empty : scriptName;
117128
ruleSuppressionId = ruleId;
129+
this.suggestedCorrection = suggestedCorrection;
118130
}
119131
}
120132

0 commit comments

Comments
 (0)