예제 #1
0
 public void JumpToMethod(MethodMetricsReport method)
 {
     if (SourceLocating != null)
     {
         new MethodHotspot(method).OnDoubleClick(SourceLocating);
     }
 }
 private static bool IsMethodAtLine(MethodMetricsReport method, LineLocation location)
 {
     return(!method.CompilerGenerated &&
            method.SourceLocation.IsAvailable &&
            string.Compare(method.SourceLocation.Filename, location.File, true) == 0 &&
            method.SourceLocation.Line >= location.Line);
 }
예제 #3
0
 internal void UpdateFor(MethodMetricsReport method)
 {
     if (!method.CompilerGenerated)
     {
         NumberOfMethods++;
         RelevantLinesOfCode += LinesOfMethodDefintion(method);
     }
 }
예제 #4
0
 internal void UpdateFor(MethodMetricsReport method)
 {
     if (!method.CompilerGenerated)
     {
         NumberOfMethods++;
         RelevantLinesOfCode += LinesOfMethodDefintion(method);
     }
 }
예제 #5
0
        public static double CyclomaticComplexity(int cc)
        {
            var metrics = new MethodMetricsReport {
                CyclomaticComplexity = cc
            };

            metrics.CommonKnowledge = new CommonReportKnowledge(1, 0, 0, 0);
            return(metrics.Rate().RatedCyclomaticComplexity);
        }
예제 #6
0
        public static double MethodLength(int ml)
        {
            var metrics = new MethodMetricsReport {
                NumberOfLogicalLines = ml
            };

            metrics.CommonKnowledge = new CommonReportKnowledge(1, 0, 0, 0);
            return(metrics.Rate().RatedMethodLength);
        }
예제 #7
0
 internal RatedMethodMetrics(MethodMetricsReport metrics)
 {
     Name                      = metrics.Name;
     Signature                 = metrics.Signature;
     CyclomaticComplexity      = metrics.CyclomaticComplexity;
     RatedCyclomaticComplexity = metrics.RateCyclomaticComplexity();
     MethodLength              = metrics.MethodLength;
     RatedMethodLength         = metrics.RateMethodLength();
 }
예제 #8
0
 internal static double RateMethodLength(this MethodMetricsReport metrics)
 {
     if (metrics.MethodLength > Limits.MethodLength(metrics.CommonKnowledge))
     {
         return(((1.0 / Limits.MethodLength(metrics.CommonKnowledge)) * metrics.MethodLength) - 1);
     }
     else
     {
         return(0.0);
     }
 }
예제 #9
0
 internal static double RateCyclomaticComplexity(this MethodMetricsReport metrics)
 {
     if (metrics.CyclomaticComplexity > Limits.CyclomaticComplexity(metrics.CommonKnowledge))
     {
         return(((1.0 / Limits.CyclomaticComplexity(metrics.CommonKnowledge)) * metrics.CyclomaticComplexity) - 1);
     }
     else
     {
         return(0.0);
     }
 }
예제 #10
0
 private void OutputMethodMetricsReport(MethodMetricsReport methodMetrics)
 {
     OutputSeperator();
     Output(String.Format("Name:\t\t{0}", methodMetrics.Name));
     Output(String.Format("Signature:\t{0}", methodMetrics.Signature));
     Output(String.Format("Generated:\t{0}", methodMetrics.CompilerGenerated));
     Output(String.Format("\tCyclomaticComplexity:\t{0}", methodMetrics.CyclomaticComplexity));
     Output(String.Format("\tNumberOfStatements:\t{0}", methodMetrics.NumberOfStatements));
     Output(String.Format("\tNumberOfRealLines:\t{0}", methodMetrics.NumberOfRealLines));
     Output(String.Format("\tNumberOfLogicalLines:\t{0}", methodMetrics.NumberOfLogicalLines));
     Output();
 }
예제 #11
0
 private bool HasJumpableLocation(MethodMetricsReport firstMethod)
 {
     return(firstMethod != null && firstMethod.SourceLocation.IsAvailable);
 }
예제 #12
0
 private void JumpToMethod(IJumpToSource jumper, MethodMetricsReport firstMethod)
 {
     jumper.JumpToFileLocation(
         firstMethod.SourceLocation.Filename,
         firstMethod.SourceLocation.Line, true);
 }
예제 #13
0
 public HotspotMethodLength(MethodMetricsReport method, MetricsReport metrics)
     : base(method)
 {
     mMetrics = metrics;
 }
 public override bool Verify(MethodMetricsReport metrics)
 {
     return(metrics.NumberOfStatements == ExpectedNumberOfStatements);
 }
예제 #15
0
 public abstract bool Verify(MethodMetricsReport metrics);
예제 #16
0
 internal MethodAndTypeMetrics(TypeMetricsReport type, MethodMetricsReport method)
 {
     this.method = method;
     this.type   = type;
 }
예제 #17
0
 public static RatedMethodMetrics Rate(this MethodMetricsReport metrics)
 {
     return(new RatedMethodMetrics(metrics));
 }
 public override bool Verify(MethodMetricsReport metrics)
 {
     return(metrics.CyclomaticComplexity == ExpectedCyclomaticComplexity);
 }
예제 #19
0
 public override bool Verify(MethodMetricsReport metrics)
 {
     return(metrics.NumberOfRealLines == ExpectedNumberOfRealLines);
 }
예제 #20
0
 public override bool Verify(MethodMetricsReport metrics)
 {
     return(!metrics.TypeDependencies.Contains(NotExpectedTypeDependency));
 }
예제 #21
0
 private static int LinesOfMethodDefintion(MethodMetricsReport method)
 {
     return(1 + method.MethodLength);
 }
예제 #22
0
 private static int LinesOfMethodDefintion(MethodMetricsReport method)
 {
     return 1 + method.MethodLength;
 }
예제 #23
0
 public HotspotCyclomaticComplexity(MethodMetricsReport method, MetricsReport metrics)
     : base(method)
 {
     mMetrics = metrics;
 }