diff --git a/ast-visual-studio-extension-tests/cx-unit-tests/cx-wrapper-tests/ResultTest.cs b/ast-visual-studio-extension-tests/cx-unit-tests/cx-wrapper-tests/ResultTest.cs index f25b060..44ff25b 100644 --- a/ast-visual-studio-extension-tests/cx-unit-tests/cx-wrapper-tests/ResultTest.cs +++ b/ast-visual-studio-extension-tests/cx-unit-tests/cx-wrapper-tests/ResultTest.cs @@ -10,6 +10,8 @@ namespace ast_visual_studio_extension_tests.cx_unit_tests.cx_wrapper_tests [Collection("Cx Collection")] public class ResultTest : BaseTest { + public static string SCAN_COMPLETED => "completed"; + [Fact] public void TestResultsHTML() { @@ -27,8 +29,9 @@ public void TestResultsJSON() { List scanList = cxWrapper.GetScans("statuses=Completed"); Assert.True(scanList.Any()); + Scan scan = scanList.FirstOrDefault(scan => scan.Status.ToLower() == SCAN_COMPLETED); - string scanId = scanList[0].ID; + string scanId = scan.ID; string results = cxWrapper.GetResults(scanId, ReportFormat.json); Assert.True(!string.IsNullOrEmpty(results)); @@ -51,8 +54,9 @@ public void TestResultsStructure() { List scanList = cxWrapper.GetScans("statuses=Completed"); Assert.True(scanList.Any()); + List completedScans = scanList.Where(scan => scan.Status.Equals("completed", StringComparison.OrdinalIgnoreCase)).ToList(); - Results results = GetFirstScanWithResults(scanList).First().Value; + Results results = GetFirstScanWithResults(completedScans).First().Value; Assert.Equal(results.totalCount, results.results.Count); } diff --git a/ast-visual-studio-extension/CxExtension/CxWindowControl.xaml b/ast-visual-studio-extension/CxExtension/CxWindowControl.xaml index 75a3d85..5972216 100644 --- a/ast-visual-studio-extension/CxExtension/CxWindowControl.xaml +++ b/ast-visual-studio-extension/CxExtension/CxWindowControl.xaml @@ -440,18 +440,22 @@ - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -548,6 +552,7 @@ + CRITICAL HIGH MEDIUM LOW diff --git a/ast-visual-studio-extension/CxExtension/CxWindowControl.xaml.cs b/ast-visual-studio-extension/CxExtension/CxWindowControl.xaml.cs index 598fe0f..a3a8d4b 100644 --- a/ast-visual-studio-extension/CxExtension/CxWindowControl.xaml.cs +++ b/ast-visual-studio-extension/CxExtension/CxWindowControl.xaml.cs @@ -44,12 +44,14 @@ public CxWindowControl(AsyncPackage package) .WithResultsTree(TreeViewResults) .WithSeverityFilters(new Dictionary { + { CriticalSeverityFilter, Severity.CRITICAL }, { HighSeverityFilter, Severity.HIGH }, { MediumSeverityFilter , Severity.MEDIUM}, { LowSeverityFilter, Severity.LOW }, { InfoSeverityFilter, Severity.INFO }, }, new Dictionary { + { Severity.CRITICAL, CriticalSeverityFilterImage }, { Severity.HIGH, HighSeverityFilterImage }, { Severity.MEDIUM, MediumSeverityFilterImage }, { Severity.LOW, LowSeverityFilterImage }, diff --git a/ast-visual-studio-extension/CxExtension/Enums/Severity.cs b/ast-visual-studio-extension/CxExtension/Enums/Severity.cs index 6117eb5..b8f40d2 100644 --- a/ast-visual-studio-extension/CxExtension/Enums/Severity.cs +++ b/ast-visual-studio-extension/CxExtension/Enums/Severity.cs @@ -2,6 +2,7 @@ { public enum Severity { + CRITICAL, HIGH, MEDIUM, LOW, diff --git a/ast-visual-studio-extension/CxExtension/Resources/C-L.png b/ast-visual-studio-extension/CxExtension/Resources/C-L.png new file mode 100644 index 0000000..5341adb Binary files /dev/null and b/ast-visual-studio-extension/CxExtension/Resources/C-L.png differ diff --git a/ast-visual-studio-extension/CxExtension/Resources/H-L.png b/ast-visual-studio-extension/CxExtension/Resources/H-L.png new file mode 100644 index 0000000..eb51324 Binary files /dev/null and b/ast-visual-studio-extension/CxExtension/Resources/H-L.png differ diff --git a/ast-visual-studio-extension/CxExtension/Resources/I-L.png b/ast-visual-studio-extension/CxExtension/Resources/I-L.png new file mode 100644 index 0000000..b8b2762 Binary files /dev/null and b/ast-visual-studio-extension/CxExtension/Resources/I-L.png differ diff --git a/ast-visual-studio-extension/CxExtension/Resources/L-L.png b/ast-visual-studio-extension/CxExtension/Resources/L-L.png new file mode 100644 index 0000000..eea468a Binary files /dev/null and b/ast-visual-studio-extension/CxExtension/Resources/L-L.png differ diff --git a/ast-visual-studio-extension/CxExtension/Resources/M-L.png b/ast-visual-studio-extension/CxExtension/Resources/M-L.png new file mode 100644 index 0000000..01634aa Binary files /dev/null and b/ast-visual-studio-extension/CxExtension/Resources/M-L.png differ diff --git a/ast-visual-studio-extension/CxExtension/Resources/critical.png b/ast-visual-studio-extension/CxExtension/Resources/critical.png new file mode 100644 index 0000000..8ebf283 Binary files /dev/null and b/ast-visual-studio-extension/CxExtension/Resources/critical.png differ diff --git a/ast-visual-studio-extension/CxExtension/Resources/critical_18x22.png b/ast-visual-studio-extension/CxExtension/Resources/critical_18x22.png new file mode 100644 index 0000000..75decd0 Binary files /dev/null and b/ast-visual-studio-extension/CxExtension/Resources/critical_18x22.png differ diff --git a/ast-visual-studio-extension/CxExtension/Resources/critical_title.png b/ast-visual-studio-extension/CxExtension/Resources/critical_title.png new file mode 100644 index 0000000..b880661 Binary files /dev/null and b/ast-visual-studio-extension/CxExtension/Resources/critical_title.png differ diff --git a/ast-visual-studio-extension/CxExtension/Resources/high.png b/ast-visual-studio-extension/CxExtension/Resources/high.png index b309110..c6b20f3 100644 Binary files a/ast-visual-studio-extension/CxExtension/Resources/high.png and b/ast-visual-studio-extension/CxExtension/Resources/high.png differ diff --git a/ast-visual-studio-extension/CxExtension/Resources/low.png b/ast-visual-studio-extension/CxExtension/Resources/low.png index 90a8d3b..04dd7ec 100644 Binary files a/ast-visual-studio-extension/CxExtension/Resources/low.png and b/ast-visual-studio-extension/CxExtension/Resources/low.png differ diff --git a/ast-visual-studio-extension/CxExtension/Resources/medium.png b/ast-visual-studio-extension/CxExtension/Resources/medium.png index 48afebe..fb94de3 100644 Binary files a/ast-visual-studio-extension/CxExtension/Resources/medium.png and b/ast-visual-studio-extension/CxExtension/Resources/medium.png differ diff --git a/ast-visual-studio-extension/CxExtension/Utils/CxConstants.cs b/ast-visual-studio-extension/CxExtension/Utils/CxConstants.cs index ad26c94..118d75d 100644 --- a/ast-visual-studio-extension/CxExtension/Utils/CxConstants.cs +++ b/ast-visual-studio-extension/CxExtension/Utils/CxConstants.cs @@ -20,14 +20,16 @@ internal class CxConstants public static string COLLAPSE_CRUMB => "..."; /************ ICONS ************/ + public static string ICON_CRITICAL => "critical.png"; + public static string ICON_CRITICAL_TITLE => "C-L.png"; public static string ICON_HIGH => "high.png"; - public static string ICON_HIGH_TITLE => "high_18x22.png"; + public static string ICON_HIGH_TITLE => "H-L.png"; public static string ICON_MEDIUM => "medium.png"; - public static string ICON_MEDIUM_TITLE => "medium_18x22.png"; + public static string ICON_MEDIUM_TITLE => "M-L.png"; public static string ICON_LOW => "low.png"; - public static string ICON_LOW_TITLE => "low_18x22.png"; + public static string ICON_LOW_TITLE => "L-L.png"; public static string ICON_INFO => "info.png"; - public static string ICON_INFO_TITLE => "info_18x22.png"; + public static string ICON_INFO_TITLE => "I-L.png"; public static string ICON_FLAG => "Flag.png"; public static string ICON_COMMENT => "Comment.png"; public static string ICON_CX_LOGO_INITIAL_PANEL => "checkmarx-80.png"; diff --git a/ast-visual-studio-extension/CxExtension/Utils/CxUtils.cs b/ast-visual-studio-extension/CxExtension/Utils/CxUtils.cs index 38563f4..80a4582 100644 --- a/ast-visual-studio-extension/CxExtension/Utils/CxUtils.cs +++ b/ast-visual-studio-extension/CxExtension/Utils/CxUtils.cs @@ -19,7 +19,9 @@ internal class CxUtils public static string GetIconPathFromSeverity(string severity, Boolean iconForTitle) { switch (GetSeverityFromString(severity)) - { + { + case Severity.CRITICAL: + return Path.Combine(CxConstants.RESOURCES_BASE_DIR, iconForTitle ? CxConstants.ICON_CRITICAL_TITLE : CxConstants.ICON_CRITICAL); case Severity.HIGH: return Path.Combine(CxConstants.RESOURCES_BASE_DIR, iconForTitle ? CxConstants.ICON_HIGH_TITLE : CxConstants.ICON_HIGH); case Severity.MEDIUM: diff --git a/ast-visual-studio-extension/CxExtension/Utils/SettingsUtils.cs b/ast-visual-studio-extension/CxExtension/Utils/SettingsUtils.cs index aeb2aa7..27ceb4f 100644 --- a/ast-visual-studio-extension/CxExtension/Utils/SettingsUtils.cs +++ b/ast-visual-studio-extension/CxExtension/Utils/SettingsUtils.cs @@ -20,6 +20,7 @@ public class SettingsUtils public static readonly Dictionary severityDefaultValues = new Dictionary { + { Severity.CRITICAL, true}, { Severity.HIGH, true }, { Severity.MEDIUM, true }, { Severity.LOW, false }, diff --git a/ast-visual-studio-extension/CxWrapper/CxWrapper.cs b/ast-visual-studio-extension/CxWrapper/CxWrapper.cs index 8cd3837..37a7e0e 100644 --- a/ast-visual-studio-extension/CxWrapper/CxWrapper.cs +++ b/ast-visual-studio-extension/CxWrapper/CxWrapper.cs @@ -319,7 +319,7 @@ public void TriageUpdate(string projectId, string similarityId, string scanType, triageArguments.Add(CxConstants.FLAG_SEVERITY); triageArguments.Add(severity); - Execution.ExecuteCommand(WithConfigArguments(triageArguments), line => null); + Execution.ExecuteCommand(WithConfigArguments(triageArguments), line => line); } /// diff --git a/ast-visual-studio-extension/CxWrapper/Models/ResultsSummary.cs b/ast-visual-studio-extension/CxWrapper/Models/ResultsSummary.cs index 6b2b5f2..dbcaae7 100644 --- a/ast-visual-studio-extension/CxWrapper/Models/ResultsSummary.cs +++ b/ast-visual-studio-extension/CxWrapper/Models/ResultsSummary.cs @@ -7,6 +7,9 @@ public class ResultsSummary [JsonProperty("TotalIssues")] public int TotalIssues { get; set; } + [JsonProperty("CriticalIssues")] + public int CriticalIssues { get; set; } + [JsonProperty("HighIssues")] public int HighIssues { get; set; } diff --git a/ast-visual-studio-extension/ast-visual-studio-extension.csproj b/ast-visual-studio-extension/ast-visual-studio-extension.csproj index 94ae269..d08be2d 100644 --- a/ast-visual-studio-extension/ast-visual-studio-extension.csproj +++ b/ast-visual-studio-extension/ast-visual-studio-extension.csproj @@ -181,6 +181,20 @@ + + Always + + + Always + + + Always + + + + + + Always true @@ -191,7 +205,6 @@ Always - true Always