@@ -31,6 +31,7 @@ internal abstract class ElementDocumentationBase : DiagnosticAnalyzer
3131 private readonly Action < SyntaxNodeAnalysisContext , StyleCopSettings > baseTypeDeclarationAction ;
3232 private readonly Action < SyntaxNodeAnalysisContext , StyleCopSettings > fieldDeclarationAction ;
3333 private readonly Action < SyntaxNodeAnalysisContext , StyleCopSettings > propertyDeclarationAction ;
34+ private readonly Action < SyntaxNodeAnalysisContext , StyleCopSettings > enumMemberDeclarationAction ;
3435
3536 protected ElementDocumentationBase ( bool inheritDocSuppressesWarnings , string matchElementName = null )
3637 {
@@ -46,6 +47,7 @@ protected ElementDocumentationBase(bool inheritDocSuppressesWarnings, string mat
4647 this . baseTypeDeclarationAction = this . HandleBaseTypeDeclaration ;
4748 this . fieldDeclarationAction = this . HandleFieldDeclaration ;
4849 this . propertyDeclarationAction = this . HandlePropertyDeclaration ;
50+ this . enumMemberDeclarationAction = this . HandleEnumMemberDeclaration ;
4951 }
5052
5153 /// <inheritdoc/>
@@ -63,6 +65,7 @@ public override void Initialize(AnalysisContext context)
6365 context . RegisterSyntaxNodeAction ( this . baseTypeDeclarationAction , SyntaxKinds . BaseTypeDeclaration ) ;
6466 context . RegisterSyntaxNodeAction ( this . fieldDeclarationAction , SyntaxKind . FieldDeclaration ) ;
6567 context . RegisterSyntaxNodeAction ( this . propertyDeclarationAction , SyntaxKind . PropertyDeclaration ) ;
68+ context . RegisterSyntaxNodeAction ( this . enumMemberDeclarationAction , SyntaxKind . EnumMemberDeclaration ) ;
6669 }
6770
6871 /// <summary>
@@ -200,6 +203,16 @@ private void HandlePropertyDeclaration(SyntaxNodeAnalysisContext context, StyleC
200203 this . HandleDeclaration ( context , settings , needsComment , node , node . Identifier . GetLocation ( ) ) ;
201204 }
202205
206+ private void HandleEnumMemberDeclaration ( SyntaxNodeAnalysisContext context , StyleCopSettings settings )
207+ {
208+ var node = ( EnumMemberDeclarationSyntax ) context . Node ;
209+
210+ Accessibility declaredAccessibility = node . GetDeclaredAccessibility ( ) ;
211+ Accessibility effectiveAccessibility = node . GetEffectiveAccessibility ( context . SemanticModel , context . CancellationToken ) ;
212+ bool needsComment = SA1600ElementsMustBeDocumented . NeedsComment ( settings . DocumentationRules , node . Kind ( ) , node . Parent . Kind ( ) , declaredAccessibility , effectiveAccessibility ) ;
213+ this . HandleDeclaration ( context , settings , needsComment , node , node . Identifier . GetLocation ( ) ) ;
214+ }
215+
203216 private void HandleDeclaration ( SyntaxNodeAnalysisContext context , StyleCopSettings settings , bool needsComment , SyntaxNode node , params Location [ ] locations )
204217 {
205218 var documentation = node . GetDocumentationCommentTriviaSyntax ( ) ;
0 commit comments