Configuration Option
Sets the visibility threshold for which members should be analyzed.Valid values:
public- Only public membersprotected- Public, protected, and protected internal members (default)internal- Public, protected, internal, and private protected membersprivate- All members including private
How Visibility Levels Work
CommentSense analyzes members at or above the configured visibility level:| Setting | Analyzes |
|---|---|
public | public |
protected | public, protected, protected internal |
internal | public, protected, internal, protected internal, private protected |
private | All members (including private) |
The default value
protected is recommended for most projects, as it ensures all externally visible members are documented while allowing flexibility for internal implementation details.Configuration Examples
Public API Only (Recommended for Libraries)
For libraries and packages distributed to external consumers, focus on public API documentation:Protected and Above (Default)
For most projects, including those with inheritance hierarchies:Internal and Above
For applications where internal APIs are also important:All Members (Including Private)
For projects with strict internal documentation requirements:Scoped Configuration
You can use different visibility levels for different parts of your codebase:Backward Compatibility
CommentSense previously used
comment_sense.analyze_internal to enable internal member analysis. This option is still supported for backward compatibility.If analyze_internal = true is set and visibility_level is not specified, CommentSense will use visibility_level = internal.Related Rules
The visibility level setting affects these diagnostics:- CSENSE001 - Missing XML documentation for public members
- CSENSE002 - Missing parameter documentation
- CSENSE004 - Missing type parameter documentation
- CSENSE006 - Missing returns documentation
- CSENSE012 - Missing exception documentation
- CSENSE014 - Missing value documentation for properties
- CSENSE018 - Missing explicit documentation for inherited members
Members below the configured visibility threshold are completely excluded from all CommentSense analysis, including quality checks and tag validation.
Best Practices
- Start with
protected(default) and adjust based on your needs - Use
publicfor libraries distributed to external consumers - Consider
internalfor applications with complex internal APIs - Avoid
privateunless you have specific documentation requirements for implementation details - Use scoped configuration to apply different levels to different parts of your codebase
See Also
- Advanced Configuration - Exclude constants, enums, and configure implicit inheritdoc
- Quality Checks - Configure documentation quality standards
- Exception Documentation - Configure exception documentation requirements