Beispiel #1
0
        public void Apply(Instance src)
        {
            if (!Matches(src))
            {
                return;
            }

            LinesOfCode                  = LinesOfCode.Max(src.LinesOfCode);
            DepthOfInheritance           = DepthOfInheritance.Max(src.DepthOfInheritance);
            CyclomaticComplexity         = CyclomaticComplexity.Max(src.CyclomaticComplexity);
            ClassCoupling                = ClassCoupling.Max(src.ClassCoupling);
            NumberOfMethods              = NumberOfMethods.Max(src.NumberOfMethods);
            AnonymousInnerClassLength    = AnonymousInnerClassLength.Max(src.AnonymousInnerClassLength);
            ClassFanOutComplexity        = ClassFanOutComplexity.Max(src.ClassFanOutComplexity);
            ClassDataAbstractionCoupling = ClassDataAbstractionCoupling.Max(src.ClassDataAbstractionCoupling);

            if (src.Members.HasValues())
            {
                Members = new List <Member>(src.Members);
            }
            if (src.Duplicates.HasValues())
            {
                Duplicates = new List <Duplicate>(src.Duplicates);
            }
        }
 protected override TypeMetricsReport AnalyzeType(INamedTypeDefinition type, PdbReader pdb, IEnumerable <MethodMetricsReport> methods)
 {
     return(new TypeMetricsReport
     {
         Name = type.Name(),
         FullName = type.FullName(),
         SourceLocation = SourceCodeLocating.OfType(type, pdb),
         Namespaces = type.Namespaces(),
         CompilerGenerated = type.IsGeneratedCode(),
         NumberOfFields = NumberOfFields.Of(type),
         NumberOfNonStaticPublicFields = NumberOfFields.NotStaticAndPublic(type),
         NumberOfMethods = NumberOfMethods.Of(type),
         DirectDependencies = DirectDependencies.Of(type, methods)
     });
 }