public override SyntaxNode VisitAttribute(AttributeSyntax node) { if (node.Name.ToString() == nameof(MethodHasDebt)) { var containingMethod = node.Ancestors().OfType <BaseMethodDeclarationSyntax>().FirstOrDefault(); if (containingMethod == null) { return(node); } if (containingMethod.ParameterList.Parameters.Count <= maxParameters && MethodLengthAnalyzer.GetMethodLength(containingMethod) < maxMethodLength) { return(null); } return(Formatter.Format(MethodDebtAnnotationProvider.GetAttribute(containingMethod), workspace)); } if (node.Name.ToString() == nameof(TypeHasDebt)) { var containingType = node.Ancestors().OfType <TypeDeclarationSyntax>().FirstOrDefault(); if (containingType == null) { return(node); } if (TypeLengthAnalyzer.GetTypeLength(containingType) < maxTypeLength && FieldCountAnalyzer.GetFieldCount(containingType) < maxFieldCount) { return(null); } return(Formatter.Format(TypeDebtAnnotationProvider.GetAttribute(containingType), workspace)); } return(base.VisitAttribute(node)); }
public override void VisitClassDeclaration(ClassDeclarationSyntax node) { var classLineCount = TypeLengthAnalyzer.GetTypeLength(node); var fieldCount = FieldCountAnalyzer.GetFieldCount(node); TypeStatistics.FoundClass(node.Identifier.ToString(), classLineCount, fieldCount); base.VisitClassDeclaration(node); }