diff --git a/DevSkim-DotNet/Microsoft.DevSkim.CLI/Writers/SarifWriter.cs b/DevSkim-DotNet/Microsoft.DevSkim.CLI/Writers/SarifWriter.cs index ebadbec9..942c056d 100644 --- a/DevSkim-DotNet/Microsoft.DevSkim.CLI/Writers/SarifWriter.cs +++ b/DevSkim-DotNet/Microsoft.DevSkim.CLI/Writers/SarifWriter.cs @@ -202,7 +202,9 @@ private void AddRuleToSarifRule(DevSkimRule devskimRule) sarifRule.FullDescription = new MultiformatMessageString() { Text = devskimRule.Description }; sarifRule.Help = new MultiformatMessageString() { - Text = devskimRule.Recommendation ?? devskimRule.Description ?? $"Visit {helpUri} for guidance on this issue.", + // If recommendation is present use that, otherwise use description if present, otherwise use the HelpUri + Text = !string.IsNullOrEmpty(devskimRule.Recommendation) ? devskimRule.Recommendation : + (!string.IsNullOrEmpty(devskimRule.Description) ? devskimRule.Description : $"Visit {helpUri} for guidance on this issue."), Markdown = $"Visit [{helpUri}]({helpUri}) for guidance on this issue." }; sarifRule.HelpUri = helpUri;