/// <summary> /// Initializes a new instance of the <see cref="MethodMetricsThresholds"/> class /// Thresholds for methods in a class /// </summary> /// <param name="activity">Code metrics activity, from where we pick off the incoming values for thresholds</param> internal MethodMetricsThresholds(CodeMetrics activity) { this.maintainabilityindexThresholds = new MetricThresholds(activity.MaintainabilityIndexWarningThreshold.Get(activity.Context), activity.MaintainabilityIndexErrorThreshold.Get(activity.Context)); this.cyclomaticComplexityThresholds = new MetricThresholds(activity.CyclomaticComplexityWarningThreshold.Get(activity.Context), activity.CyclomaticComplexityErrorThreshold.Get(activity.Context)); this.couplingThresholds = new MetricThresholds(activity.CouplingWarningThreshold.Get(activity.Context), activity.CouplingErrorThreshold.Get(activity.Context)); this.linesOfCodeThresholds = new MetricThresholds(activity.LinesOfCodeWarningThreshold.Get(activity.Context), activity.LinesOfCodeErrorThreshold.Get(activity.Context)); }
/// <summary> /// Initializes a new instance of the <see cref="TypeMetricsThresholds"/> class /// Thresholds for Types (Classes) /// </summary> /// <param name="activity">Code metrics activity, from where we pick off the incoming values for thresholds</param> /// <param name="methodMetricsThresholds">The class thresholds depends on the method thresholds, so we need this first</param> internal TypeMetricsThresholds(CodeMetrics activity, MethodMetricsThresholds methodMetricsThresholds) { this.methodMetricsThresholds = methodMetricsThresholds; this.depthOfInheritanceThresholds = new MetricThresholds(activity.DepthOfInheritanceWarningThreshold.Get(activity.Context), activity.DepthOfInheritanceErrorThreshold.Get(activity.Context)); this.couplingThresholds = new MetricThresholds(methodMetricsThresholds.CouplingThresholds); this.couplingThresholds *= CouplingFactor; this.linesOfCodeThresholds = new MetricThresholds(methodMetricsThresholds.LinesOfCodeThresholds); this.linesOfCodeThresholds *= LinesOfCodeFactor; }
/// <summary> /// Named multiply operator to scale a metrics up (or down) by a given factor. /// </summary> /// <param name="target">object to be scaled</param> /// <param name="factor">Scale factor</param> /// <returns>returns scaled object</returns> public static MetricThresholds Multiply(MetricThresholds target, int factor) { target.Error *= factor; target.Warning *= factor; return(target); }
/// <summary> /// Initializes a new instance of the <see cref="MetricThresholds"/> class /// Copy constructor for Metric thresholds class /// </summary> /// <param name="other">The class to copy from</param> public MetricThresholds(MetricThresholds other) { this.Error = other.Error; this.Warning = other.Warning; }
/// <summary> /// Named multiply operator to scale a metrics up (or down) by a given factor. /// </summary> /// <param name="target">object to be scaled</param> /// <param name="factor">Scale factor</param> /// <returns>returns scaled object</returns> public static MetricThresholds Multiply(MetricThresholds target, int factor) { target.Error *= factor; target.Warning *= factor; return target; }
protected HigherIsWorseMetric(MetricThresholds thresholdvalues) : base(thresholdvalues) { }
protected MetricCheck(MetricThresholds thresholdvalues) { this.WarningLimit = thresholdvalues.Warning; this.ErrorLimit = thresholdvalues.Error; }