@@ -229,34 +229,34 @@ private void HandleDeclaration(SyntaxNodeAnalysisContext context, StyleCopSettin
229229 return ;
230230 }
231231
232- IEnumerable < XmlNodeSyntax > matchingXmlElements = string . IsNullOrEmpty ( this . matchElementName )
233- ? documentation . Content
234- . Where ( x => x is XmlElementSyntax || x is XmlEmptyElementSyntax )
235- . Where ( x => ! string . Equals ( x . GetName ( ) ? . ToString ( ) , XmlCommentHelper . IncludeXmlTag , StringComparison . Ordinal ) )
236- : documentation . Content . GetXmlElements ( this . matchElementName ) ;
232+ var hasIncludedDocumentation =
233+ documentation . Content . GetFirstXmlElement ( XmlCommentHelper . IncludeXmlTag ) is object ;
237234
238- if ( ! matchingXmlElements . Any ( ) )
235+ if ( hasIncludedDocumentation )
239236 {
240- var includedDocumentation = documentation . Content . GetFirstXmlElement ( XmlCommentHelper . IncludeXmlTag ) ;
241- if ( includedDocumentation != null )
237+ var declaration = context . SemanticModel . GetDeclaredSymbol ( node , context . CancellationToken ) ;
238+ var rawDocumentation = declaration ? . GetDocumentationCommentXml ( expandIncludes : true , cancellationToken : context . CancellationToken ) ;
239+ var completeDocumentation = XElement . Parse ( rawDocumentation , LoadOptions . None ) ;
240+
241+ if ( this . inheritDocSuppressesWarnings &&
242+ completeDocumentation . Nodes ( ) . OfType < XElement > ( ) . Any ( element => element . Name == XmlCommentHelper . InheritdocXmlTag ) )
242243 {
243- var declaration = context . SemanticModel . GetDeclaredSymbol ( node , context . CancellationToken ) ;
244- var rawDocumentation = declaration ? . GetDocumentationCommentXml ( expandIncludes : true , cancellationToken : context . CancellationToken ) ;
245- var completeDocumentation = XElement . Parse ( rawDocumentation , LoadOptions . None ) ;
246-
247- if ( this . inheritDocSuppressesWarnings &&
248- completeDocumentation . Nodes ( ) . OfType < XElement > ( ) . Any ( element => element . Name == XmlCommentHelper . InheritdocXmlTag ) )
249- {
250- // Ignore nodes with an <inheritdoc/> tag in the included XML.
251- return ;
252- }
253-
254- this . HandleCompleteDocumentation ( context , needsComment , completeDocumentation , locations ) ;
255- return ; // done
244+ // Ignore nodes with an <inheritdoc/> tag in the included XML.
245+ return ;
256246 }
247+
248+ this . HandleCompleteDocumentation ( context , needsComment , completeDocumentation , locations ) ;
257249 }
250+ else
251+ {
252+ IEnumerable < XmlNodeSyntax > matchingXmlElements = string . IsNullOrEmpty ( this . matchElementName )
253+ ? documentation . Content
254+ . Where ( x => x is XmlElementSyntax || x is XmlEmptyElementSyntax )
255+ . Where ( x => ! string . Equals ( x . GetName ( ) ? . ToString ( ) , XmlCommentHelper . IncludeXmlTag , StringComparison . Ordinal ) )
256+ : documentation . Content . GetXmlElements ( this . matchElementName ) ;
258257
259- this . HandleXmlElement ( context , settings , needsComment , matchingXmlElements , locations ) ;
258+ this . HandleXmlElement ( context , settings , needsComment , matchingXmlElements , locations ) ;
259+ }
260260 }
261261 }
262262}
0 commit comments