/// <summary> /// Check that the given declaration has an xml documentation comment. /// </summary> /// <param name="declaration">The declaration to check</param> /// <param name="docNode">The documentation node to check.</param> /// <param name="highlightingConsumer">Highlighting consumer</param> public void CheckMemberHasComment( IClassMemberDeclaration declaration, XmlNode docNode, IHighlightingConsumer highlightingConsumer) { // Only process this one if its range is invalid. //if (!_daemonProcess.IsRangeInvalidated(declaration.GetDocumentRange())) return; // Check if the parent doco is null if (_xmlDocumentationSettings.SuppressIfBaseHasComment) { if (docNode == null && declaration.GetXMLDoc(true) != null) { return; } } if (docNode != null) { return; } Match[] publicMembers = new[] { new Match( Declaration.Any, AccessLevels.Public | AccessLevels.Protected | AccessLevels.ProtectedInternal) }; Match[] internalMembers = new[] { new Match(Declaration.Any, AccessLevels.Internal) }; Match[] privateMembers = new[] { new Match(Declaration.Any, AccessLevels.Private) }; Match match = ComplexMatchEvaluator.IsMatch(declaration, privateMembers, null, true); if (match != null) { var highlighting = new PrivateMemberMissingXmlCommentHighlighting(declaration, match); var file = declaration.GetContainingFile(); var range = file.TranslateRangeForHighlighting(declaration.GetNameRange()); highlightingConsumer.AddHighlighting(highlighting, range, file); return; } match = ComplexMatchEvaluator.IsMatch(declaration, internalMembers, null, true); if (match != null) { var highlighting = new InternalMemberMissingXmlCommentHighlighting(declaration, match); var file = declaration.GetContainingFile(); var range = file.TranslateRangeForHighlighting(declaration.GetNameRange()); highlightingConsumer.AddHighlighting(highlighting, range, file); return; } match = ComplexMatchEvaluator.IsMatch(declaration, publicMembers, null, true); if (match != null) { var highlighting = new PublicMemberMissingXmlCommentHighlighting(declaration, match); var file = declaration.GetContainingFile(); var range = file.TranslateRangeForHighlighting(declaration.GetNameRange()); highlightingConsumer.AddHighlighting(highlighting, range, file); // return; } }
/// <summary> /// Check that the given declaration has an xml documentation comment. /// </summary> /// <param name="declaration">The declaration to check</param> /// <param name="docNode">The documentation node to check.</param> /// <param name="consumer">The list of highlights (errors) that were found - add to this any new issues</param> public void CheckMemberHasComment(IClassMemberDeclaration declaration, [CanBeNull] XmlNode docNode, DefaultHighlightingConsumer consumer) { // Only process this one if its range is invalid. //if (!_daemonProcess.IsRangeInvalidated(declaration.GetDocumentRange())) return; // Check if the parent doco is null if (_xmlDocumentationSettings.SuppressIfBaseHasComment) { if (docNode == null && declaration.GetXMLDoc(true) != null) { return; } } if (docNode != null) { return; } //check if project should be ignored if (ShouldIgnoreProject(declaration.GetProject()?.Name)) { return; } Match[] publicMembers = new[] { new Match( Declaration.Any, AccessLevels.Public | AccessLevels.Protected | AccessLevels.ProtectedInternal) }; Match[] internalMembers = new[] { new Match(Declaration.Any, AccessLevels.Internal) }; Match[] privateMembers = new[] { new Match(Declaration.Any, AccessLevels.Private) }; Match match = ComplexMatchEvaluator.IsMatch(declaration, privateMembers, null, true); IFile containingFile = declaration.GetContainingFile(); if (match != null) { consumer.AddHighlighting( new PrivateMemberMissingXmlCommentHighlighting(declaration, match), containingFile.TranslateRangeForHighlighting(declaration.GetNameRange())); return; } match = ComplexMatchEvaluator.IsMatch(declaration, internalMembers, null, true); if (match != null) { consumer.AddHighlighting( new InternalMemberMissingXmlCommentHighlighting(declaration, match), containingFile.TranslateRangeForHighlighting(declaration.GetNameRange())); return; } match = ComplexMatchEvaluator.IsMatch(declaration, publicMembers, null, true); if (match != null) { consumer.AddHighlighting( new PublicMemberMissingXmlCommentHighlighting(declaration, match), containingFile.TranslateRangeForHighlighting(declaration.GetNameRange())); } }