Skip to content

Commit f18af6c

Browse files
committed
needs style changes for group
1 parent 502f815 commit f18af6c

File tree

5 files changed

+74
-10
lines changed

5 files changed

+74
-10
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ ThresholdForNPathComplexity When [npath complexity](https://en.wikipedia.
129129
ThresholdForCrapScore When [crap score](https://testing.googleblog.com/2011/02/this-code-is-crap.html) exceeds this value for a method then the method will be present in the risk hotspots tab. OpenCover only.
130130
131131
StickyCoverageTable Set to true for coverage table to have a sticky thead.
132+
NamespacedClasses Set to false to show classes in report in short form. Affects grouping.
132133
133134
RunSettingsOnly Specify false for global and project options to be used for coverlet data collector configuration elements when not specified in runsettings
134135
CoverletCollectorDirectoryPath Specify path to directory containing coverlet collector files if you need functionality that the FCC version does not provide.

SharedProject/Core/ReportGenerator/ReportGeneratorUtil.cs

+68-9
Original file line numberDiff line numberDiff line change
@@ -732,8 +732,38 @@ function Plugin(el, options)
732732
";
733733
}
734734
735+
private string GetGroupingCss(bool namespacedClasses)
736+
{
737+
if (namespacedClasses)
738+
{
739+
return "";
740+
}
741+
return HideGroupingCss();
742+
743+
}
744+
745+
private string HideGroupingCss()
746+
{
747+
return @"
748+
coverage-info div.customizebox div:nth-child(2) { visibility:hidden;font-size:1px;height:1px;padding:0;border:0;margin:0 }
749+
coverage-info div.customizebox div:nth-child(2) * { visibility:hidden;font-size:1px;height:1px;padding:0;border:0;margin:0 }
750+
";
751+
}
752+
753+
private string HackGroupingToAllowAll()
754+
{
755+
return @"
756+
var customizeBox = document.getElementsByClassName('customizebox')[0];
757+
var groupingInput = customizeBox.querySelector('input');
758+
groupingInput.max = 1;
759+
";
760+
761+
}
762+
735763
public string ProcessUnifiedHtml(string htmlForProcessing, string reportOutputFolder)
736764
{
765+
var appOptions = appOptionsProvider.Get();
766+
var namespacedClasses = appOptions.NamespacedClasses;
737767
reportColours = reportColoursProvider.GetColours();
738768
return assemblyUtil.RunInAssemblyResolvingContext(() =>
739769
{
@@ -792,10 +822,12 @@ public string ProcessUnifiedHtml(string htmlForProcessing, string reportOutputFo
792822
}
793823
else
794824
{
795-
// simplify name
796-
var lastIndexOfDotInName = className.LastIndexOf('.');
797-
if (lastIndexOfDotInName != -1) @class["name"] = className.Substring(lastIndexOfDotInName).Trim('.');
798-
825+
if (!namespacedClasses)
826+
{
827+
// simplify name
828+
var lastIndexOfDotInName = className.LastIndexOf('.');
829+
if (lastIndexOfDotInName != -1) @class["name"] = className.Substring(lastIndexOfDotInName).Trim('.');
830+
}
799831
//mark with # and add the assembly name
800832
var rp = @class["rp"].ToString();
801833
var htmlIndex = rp.IndexOf(".html");
@@ -825,9 +857,12 @@ public string ProcessUnifiedHtml(string htmlForProcessing, string reportOutputFo
825857
{
826858
var assembly = riskHotspot["assembly"].ToString();
827859
var qualifiedClassName = riskHotspot["class"].ToString();
828-
// simplify name
829-
var lastIndexOfDotInName = qualifiedClassName.LastIndexOf('.');
830-
if (lastIndexOfDotInName != -1) riskHotspot["class"] = qualifiedClassName.Substring(lastIndexOfDotInName).Trim('.');
860+
if (!namespacedClasses)
861+
{
862+
// simplify name
863+
var lastIndexOfDotInName = qualifiedClassName.LastIndexOf('.');
864+
if (lastIndexOfDotInName != -1) riskHotspot["class"] = qualifiedClassName.Substring(lastIndexOfDotInName).Trim('.');
865+
}
831866
var newReportPath = $"#{assembly}{assemblyClassDelimiter}{qualifiedClassName}.html";
832867
riskHotspot["reportPath"] = newReportPath;
833868
}
@@ -847,19 +882,35 @@ public string ProcessUnifiedHtml(string htmlForProcessing, string reportOutputFo
847882
table,tr,th,td {{ font-size: small; }}
848883
body {{ -webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none }}
849884
table.overview th, table.overview td {{ font-size: small; white-space: nowrap; word-break: normal; padding-left:10px;padding-right:10px; }}
850-
coverage-info div.customizebox div:nth-child(2) {{ visibility:hidden;font-size:1px;height:1px;padding:0;border:0;margin:0 }}
851-
coverage-info div.customizebox div:nth-child(2) * {{ visibility:hidden;font-size:1px;height:1px;padding:0;border:0;margin:0 }}
885+
{GetGroupingCss(namespacedClasses)}
852886
table,tr,th,td {{ border: 1px solid; font-size: small; }}
853887
input[type=text] {{ color:{ToJsColour(reportColours.TextBoxTextColour)}; background-color:{ToJsColour(reportColours.TextBoxColour)};border-color:{ToJsColour(reportColours.TextBoxBorderColour)} }}
854888
select {{ color:{ToJsColour(reportColours.ComboBoxTextColour)}; background-color:{ToJsColour(reportColours.ComboBoxColour)};border-color:{ToJsColour(reportColours.ComboBoxBorderColour)} }}
855889
body, html {{ scrollbar-arrow-color:{ToJsColour(reportColours.ScrollBarArrowColour)};scrollbar-track-color:{ToJsColour(reportColours.ScrollBarTrackColour)};scrollbar-face-color:{scrollbarThumbColour};scrollbar-shadow-color:{scrollbarThumbColour};scrollbar-highlight-color:{scrollbarThumbColour};scrollbar-3dlight-color:{scrollbarThumbColour};scrollbar-darkshadow-color:{scrollbarThumbColour} }}
890+
input[type=range]::-ms-thumb {{
891+
background: {scrollbarThumbColour};
892+
border: {scrollbarThumbColour}
893+
}}
894+
input[type=range]::-ms-track {{
895+
color: transparent;
896+
border-color: transparent;
897+
background: transparent;
898+
}}
899+
900+
input[type=range]::-ms-fill-lower {{
901+
background: {ToJsColour(reportColours.ScrollBarTrackColour)};
902+
}}
903+
input[type=range]::-ms-fill-upper {{
904+
background: {ToJsColour(reportColours.ScrollBarTrackColour)};
905+
}}
856906
</style>
857907
</head>
858908
");
859909
860910
htmlSb.Replace("</body>", $@"
861911
<script type=""text/javascript"">
862912
{GetStickyTableHead()}
913+
{HackGroupingToAllowAll()}
863914
function getRuleBySelector(cssRules,selector){{
864915
for(var i=0;i<cssRules.length;i++){{
865916
if(cssRules[i].selectorText == selector){{
@@ -887,6 +938,14 @@ function getStyleSheetById(id){{
887938
888939
var fccStyleSheet1Rules = getStyleSheetById('fccStyle1').cssRules;
889940
941+
var rangeInputFillLower = getStyleBySelector(fccStyleSheet1Rules, 'input[type=range]::-ms-fill-lower');
942+
rangeInputFillLower.setProperty('background',theme.{nameof(JsThemeStyling.ScrollBarTrack)});
943+
var rangeInputFillUpper = getStyleBySelector(fccStyleSheet1Rules, 'input[type=range]::-ms-fill-upper');
944+
rangeInputFillUpper.setProperty('background',theme.{nameof(JsThemeStyling.ScrollBarTrack)});
945+
var rangeInputThumb = getStyleBySelector(fccStyleSheet1Rules, 'input[type=range]::-ms-thumb');
946+
rangeInputThumb.setProperty('background',theme.{nameof(JsThemeStyling.ScrollBarThumb)});
947+
rangeInputThumb.setProperty('border',theme.{nameof(JsThemeStyling.ScrollBarThumb)});
948+
890949
var scrollBarStyle = getStyleBySelector(fccStyleSheet1Rules,'body, html');
891950
scrollBarStyle.setProperty('scrollbar-arrow-color',theme.{nameof(JsThemeStyling.ScrollBarArrow)});
892951
scrollBarStyle.setProperty('scrollbar-track-color',theme.{nameof(JsThemeStyling.ScrollBarTrack)});

SharedProject/Core/ReportGenerator/ThemeResourceKeyProvider.cs

-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ public ThemeResourceKey Provide(string reportPart)
8080
{
8181
throw new Exception($"Cannot find report part {reportPart}");
8282
}
83-
return null;
8483
}
8584
}
8685

SharedProject/Options/AppOptions.cs

+4
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ You can also ignore additional attributes by adding to this list (short name or
159159
[Description("Set to true for coverage table to have a sticky thead.")]
160160
public bool StickyCoverageTable { get; set; }
161161

162+
[Category(reportCategory)]
163+
[Description("Set to false to show classes in report in short form.")]
164+
public bool NamespacedClasses { get; set; } = true;
165+
162166
[SuppressMessage("Usage", "VSTHRD010:Invoke single-threaded types on Main thread")]
163167
public override void SaveSettingsToStorage()
164168
{

SharedProject/Options/IAppOptions.cs

+1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@ public interface IAppOptions
2323
int ThresholdForCrapScore { get; }
2424
bool CoverageColoursFromFontsAndColours { get; }
2525
bool StickyCoverageTable { get; }
26+
bool NamespacedClasses { get; }
2627
}
2728
}

0 commit comments

Comments
 (0)