diff --git a/src/Readme.txt b/src/Readme.txt
index b8fa47ac..76fc1629 100644
--- a/src/Readme.txt
+++ b/src/Readme.txt
@@ -61,6 +61,7 @@ CHANGELOG
4.1.6.0
* New: Issue #239: Added link back to the summary page
+ * New: Issue #242: Added option to remove risk hotspots section
4.1.5.0
diff --git a/src/ReportGenerator.Core/CodeAnalysis/RiskHotspotsAnalysisThresholds.cs b/src/ReportGenerator.Core/CodeAnalysis/RiskHotspotsAnalysisThresholds.cs
index 8c1efa3f..1d61fb7b 100644
--- a/src/ReportGenerator.Core/CodeAnalysis/RiskHotspotsAnalysisThresholds.cs
+++ b/src/ReportGenerator.Core/CodeAnalysis/RiskHotspotsAnalysisThresholds.cs
@@ -5,6 +5,11 @@
///
public class RiskHotspotsAnalysisThresholds
{
+ ///
+ /// Gets or sets a value indicating whether risk hotspots should be disabled or not.
+ ///
+ public bool DisableRiskHotspots { get; set; } = false;
+
///
/// Gets or sets the threshold for cylomatic complexity.
///
diff --git a/src/ReportGenerator.Core/CodeAnalysis/RiskHotspotsAnalyzer.cs b/src/ReportGenerator.Core/CodeAnalysis/RiskHotspotsAnalyzer.cs
index 7af72344..dae955fc 100644
--- a/src/ReportGenerator.Core/CodeAnalysis/RiskHotspotsAnalyzer.cs
+++ b/src/ReportGenerator.Core/CodeAnalysis/RiskHotspotsAnalyzer.cs
@@ -10,6 +10,11 @@ namespace Palmmedia.ReportGenerator.Core.CodeAnalysis
///
internal class RiskHotspotsAnalyzer : IRiskHotspotsAnalyzer
{
+ ///
+ /// Indicates whether risk hotspots should be disabled or not.
+ ///
+ private readonly bool disabled;
+
///
/// The thresholds of the various metrics.
///
@@ -21,6 +26,8 @@ internal class RiskHotspotsAnalyzer : IRiskHotspotsAnalyzer
/// The metric thresholds.
public RiskHotspotsAnalyzer(RiskHotspotsAnalysisThresholds riskHotspotsAnalysisThresholds)
{
+ this.disabled = riskHotspotsAnalysisThresholds.DisableRiskHotspots;
+
this.thresholdsByMetricName = new Dictionary()
{
{ ReportResources.CyclomaticComplexity, riskHotspotsAnalysisThresholds.MetricThresholdForCyclomaticComplexity },
@@ -37,6 +44,12 @@ public RiskHotspotsAnalyzer(RiskHotspotsAnalysisThresholds riskHotspotsAnalysisT
public RiskHotspotAnalysisResult PerformRiskHotspotAnalysis(IEnumerable assemblies)
{
var riskHotspots = new List();
+
+ if (this.disabled)
+ {
+ return new RiskHotspotAnalysisResult(riskHotspots, false);
+ }
+
decimal threshold = -1;
bool codeCodeQualityMetricsAvailable = false;
diff --git a/src/ReportGenerator.Core/appsettings.json b/src/ReportGenerator.Core/appsettings.json
index 3428d8a3..adac3c7d 100644
--- a/src/ReportGenerator.Core/appsettings.json
+++ b/src/ReportGenerator.Core/appsettings.json
@@ -1,5 +1,6 @@
{
"riskHotspotsAnalysisThresholds": {
+ "disableRiskHotspots": false,
"metricThresholdForCyclomaticComplexity": 30,
"metricThresholdForCrapScore": 15,
"metricThresholdForNPathComplexity": 200