Skip to content

Commit a1f8425

Browse files
committed
REPORTGEN-397 : do not repeat file path if it is the same as previous
1 parent 4442047 commit a1f8425

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

CastReporting.Reporting/Helper/MetricsUtility.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Collections.Generic;
55
using System.Drawing;
66
using System.Linq;
7+
using System.Security;
78
using CastReporting.Reporting.ReportingModel;
89
using CastReporting.Reporting.Helper;
910
using CastReporting.Reporting.Languages;
@@ -633,11 +634,17 @@ public static int PopulateViolationsBookmarks(ReportData reportData, Violation[]
633634
rowData.Add(Labels.ViolationPath + " #" + pathCounter);
634635
cellProps.Add(new CellAttributes(cellidx, Color.Lavender));
635636
cellidx++;
637+
string previousFile = string.Empty;
636638
foreach (CodeBookmark _bookval in _bookmarksValue)
637639
{
638-
rowData.Add(Labels.FilePath + ": " + _bookval.CodeFragment.CodeFile.Name);
639-
cellProps.Add(new CellAttributes(cellidx, Color.White));
640-
cellidx++;
640+
if (string.IsNullOrEmpty(previousFile) || !previousFile.Equals(_bookval.CodeFragment.CodeFile.Name))
641+
{
642+
previousFile = _bookval.CodeFragment.CodeFile.Name;
643+
rowData.Add(Labels.FilePath + ": " + _bookval.CodeFragment.CodeFile.Name);
644+
cellProps.Add(new CellAttributes(cellidx, Color.White));
645+
cellidx++;
646+
}
647+
641648
Dictionary<int, string> codeLines = reportData.SnapshotExplorer.GetSourceCodeBookmark(domainId, _bookval, 0);
642649

643650
foreach (KeyValuePair<int, string> codeLine in codeLines)

0 commit comments

Comments
 (0)