public RuleResult CheckType(TypeDefinition type) { // don't analyze cases where no methods (or body) are available if (type.IsEnum || type.IsInterface) { return(RuleResult.DoesNotApply); } foreach (TypeDefinition module_type in type.Module.GetAllTypes()) { if ((module_type.BaseType != null) && module_type.BaseType.Equals(type)) { siblingClasses.Add(module_type); } } if (siblingClasses.Count >= 2) { codeDuplicatedLocator.Clear(); foreach (TypeDefinition sibling in siblingClasses) { FindCodeDuplicated(sibling); codeDuplicatedLocator.CheckedTypes.AddIfNew(sibling.Name); } } siblingClasses.Clear(); return(Runner.CurrentRuleResult); }
public RuleResult CheckType(TypeDefinition type) { // don't analyze cases where no methods (or body) are available if (type.IsEnum || type.IsInterface || !type.HasMethods) { return(RuleResult.DoesNotApply); } // ignore code generated by compiler/tools, since they can generate some amount of duplicated code if (type.IsGeneratedCode()) { return(RuleResult.DoesNotApply); } locator.Clear(); foreach (MethodDefinition current in type.Methods) { locator.CompareMethodAgainstTypeMethods(current, type); locator.CheckedMethods.AddIfNew(current.Name); } return(Runner.CurrentRuleResult); }