protected override void ProcessInternal(INamedTypeSymbol symbol, PolicyConfig policyConfig, IViolationReporter violationReporter) { ClassConfig config = policyConfig.StructConfig; if (!AnyVisibilityMatches(symbol.DeclaredAccessibility, config.VisibilitiesToCheck)) { return; } IDocumentationComment classDocumentation = symbol.GetDocumentationComment(); if (config.SampleDocumentationRequired && string.IsNullOrWhiteSpace(classDocumentation.ExampleText)) { violationReporter.Report(ViolationFromSymbol(ViolationMessage.MissingSampleDocumentation, symbol)); } if (config.SummaryDocumentationRequired && string.IsNullOrWhiteSpace(classDocumentation.SummaryText)) { violationReporter.Report(ViolationFromSymbol(ViolationMessage.MissingSummaryDocumentation, symbol)); } if (!symbol.TypeParameters.IsEmpty && config.GenericParameterDocumentationRequired) { foreach (ITypeParameterSymbol typeParameter in symbol.TypeParameters) { if (string.IsNullOrWhiteSpace(classDocumentation.GetTypeParameterText(typeParameter.Name))) { violationReporter.Report(ViolationFromSymbol(string.Format(ViolationMessage.MissingTypeParameter, typeParameter.Name), symbol)); } } } ProcessChildren(symbol, policyConfig, violationReporter); }
protected override void ProcessInternal(INamedTypeSymbol symbol, PolicyConfig policyConfig, IViolationReporter violationReporter) { DelegateConfig config = policyConfig.DelegateConfig; if (!AnyVisibilityMatches(symbol.DeclaredAccessibility, config.VisibilitiesToCheck)) { return; } if (symbol.DelegateInvokeMethod == null) { return; } IDocumentationComment documentation = symbol.GetDocumentationComment(); if (config.SampleDocumentationRequired && string.IsNullOrWhiteSpace(documentation.ExampleText)) { violationReporter.Report(ViolationFromSymbol(ViolationMessage.MissingSampleDocumentation, symbol)); } if (config.SummaryDocumentationRequired && string.IsNullOrWhiteSpace(documentation.SummaryText)) { violationReporter.Report(ViolationFromSymbol(ViolationMessage.MissingSummaryDocumentation, symbol)); } if (config.ResultDocumentationRequired && !symbol.DelegateInvokeMethod.ReturnsVoid && string.IsNullOrWhiteSpace(documentation.ReturnsText)) { violationReporter.Report(ViolationFromSymbol(ViolationMessage.MissingReturnsDocumentation, symbol)); } if (config.ParameterDocumentationRequired && !symbol.DelegateInvokeMethod.Parameters.IsEmpty) { foreach (IParameterSymbol parameterSymbol in symbol.DelegateInvokeMethod.Parameters) { if (string.IsNullOrWhiteSpace(documentation.GetParameterText(parameterSymbol.Name))) { violationReporter.Report(ViolationFromSymbol(string.Format(ViolationMessage.MissingParameter, parameterSymbol.Name), symbol)); } } } if (config.GenericParameterDocumentationRequired && !symbol.TypeParameters.IsEmpty) { foreach (ITypeParameterSymbol typeParameter in symbol.TypeParameters) { if (string.IsNullOrWhiteSpace(documentation.GetTypeParameterText(typeParameter.Name))) { violationReporter.Report(ViolationFromSymbol(string.Format(ViolationMessage.MissingTypeParameter, typeParameter.Name), symbol)); } } } }
protected override void Process(ISymbol symbol, PolicyConfig policyConfig, IViolationReporter violationReporter) { EventConfig config = policyConfig.EventConfig; if (symbol.IsOverride && !config.DocumentOverrides) { return; } if (symbol.ContainingType != null && symbol.ContainingType.TypeKind == TypeKind.Interface && !config.InterfaceDeclarationDocumentationRequired) { return; } if (!symbol.CanBeReferencedByName && !config.ExplicitInterfaceEventDocumentationRequired) { return; } if (!AnyVisibilityMatches(symbol.DeclaredAccessibility, config.VisibilitiesToCheck) && symbol.CanBeReferencedByName) { return; } IDocumentationComment documentation = symbol.GetDocumentationComment(); if (config.SummaryDocumentationRequired && string.IsNullOrWhiteSpace(documentation.SummaryText)) { violationReporter.Report(ViolationFromSymbol(ViolationMessage.MissingSummaryDocumentation, symbol)); } }
protected override void ProcessInternal(INamedTypeSymbol symbol, PolicyConfig policyConfig, IViolationReporter violationReporter) { EnumConfig enumConfig = policyConfig.EnumConfig; if (!AnyVisibilityMatches(symbol.DeclaredAccessibility, enumConfig.VisibilitiesToCheck)) { return; } IDocumentationComment classDocumentation = symbol.GetDocumentationComment(); if (enumConfig.SummaryDocumentationRequired && string.IsNullOrWhiteSpace(classDocumentation.SummaryText)) { violationReporter.Report(ViolationFromSymbol(ViolationMessage.MissingSummaryDocumentation, symbol)); } }
protected override void Process(ISymbol symbol, PolicyConfig policyConfig, IViolationReporter violationReporter) { FieldConfig config = policyConfig.FieldConfig; if ((!AnyVisibilityMatches(symbol.DeclaredAccessibility, config.VisibilitiesToCheck) || !symbol.CanBeReferencedByName)) { return; } IDocumentationComment documentation = symbol.GetDocumentationComment(); if (config.SummaryDocumentationRequired && string.IsNullOrWhiteSpace(documentation.SummaryText)) { violationReporter.Report(ViolationFromSymbol(ViolationMessage.MissingSummaryDocumentation, symbol)); } }
protected override void Process(ISymbol symbol, PolicyConfig policyConfig, IViolationReporter violationReporter) { IMethodSymbol methodSymbol = (IMethodSymbol)symbol; MethodConfig config = policyConfig.MethodConfig; if (methodSymbol.IsOverride && !config.DocumentOverrides) { return; } if (methodSymbol.MethodKind == MethodKind.ExplicitInterfaceImplementation && !config.ExplicitInterfaceMethodDocumentationRequired) { return; } if (!AnyVisibilityMatches(symbol.DeclaredAccessibility, config.VisibilitiesToCheck) && methodSymbol.MethodKind != MethodKind.ExplicitInterfaceImplementation) { return; } // skip compiler generated methods for which there is no source code if (symbol.IsImplicitlyDeclared) { return; } // skip special method kinds if (!AllowedMethodKinds.Contains(methodSymbol.MethodKind)) { return; } IDocumentationComment documentation = symbol.GetDocumentationComment(); if (config.SampleDocumentationRequired && string.IsNullOrWhiteSpace(documentation.ExampleText)) { violationReporter.Report(ViolationFromSymbol(ViolationMessage.MissingSampleDocumentation, symbol)); } if (config.SummaryDocumentationRequired && string.IsNullOrWhiteSpace(documentation.SummaryText)) { violationReporter.Report(ViolationFromSymbol(ViolationMessage.MissingSummaryDocumentation, symbol)); } if (config.ResultDocumentationRequired && !methodSymbol.ReturnsVoid && string.IsNullOrWhiteSpace(documentation.ReturnsText)) { violationReporter.Report(ViolationFromSymbol(ViolationMessage.MissingReturnsDocumentation, symbol)); } if (config.ParameterDocumentationRequired && !methodSymbol.Parameters.IsEmpty) { foreach (IParameterSymbol parameterSymbol in methodSymbol.Parameters) { if (string.IsNullOrWhiteSpace(documentation.GetParameterText(parameterSymbol.Name))) { violationReporter.Report(ViolationFromSymbol(string.Format(ViolationMessage.MissingParameter, parameterSymbol.Name), symbol)); } } } if (config.GenericParameterDocumentationRequired && !methodSymbol.TypeParameters.IsEmpty) { foreach (ITypeParameterSymbol typeParameter in methodSymbol.TypeParameters) { if (string.IsNullOrWhiteSpace(documentation.GetTypeParameterText(typeParameter.Name))) { violationReporter.Report(ViolationFromSymbol(string.Format("Missing documentation for type parameter with name '{0}'", typeParameter.Name), symbol)); } } } }