CommentSense 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package CommentSense --version 0.1.0
                    
NuGet\Install-Package CommentSense -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CommentSense" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CommentSense" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="CommentSense" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CommentSense --version 0.1.0
                    
#r "nuget: CommentSense, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CommentSense@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CommentSense&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=CommentSense&version=0.1.0
                    
Install as a Cake Tool

CommentSense

CommentSense is a Roslyn-based diagnostic analyzer for C# designed to ensure that public-facing APIs are consistently and meaningfully documented.

Requirements

For CommentSense to analyze your documentation, your project must have XML documentation generation enabled. Add the following property to your .csproj file:

<PropertyGroup>
  <GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

Rules

Project Configuration

  • CSENSE000: Warns when XML documentation parsing is disabled for the project. CommentSense relies on the compiler's documentation parsing to analyze your code. Enable it by following the Requirements section above.

General Documentation

  • CSENSE001: Ensures public members have XML documentation (e.g., <summary>, <inheritdoc />, or other content tags).
    • Default: Analyzes public, protected, and protected internal members.
    • Configurable: Enable for internal members using comment_sense.analyze_internal.
  • CSENSE016: Flags "low quality" documentation.
    • Default: Flags empty content or content that just repeats the symbol name.
    • Configurable: Add custom terms using comment_sense.low_quality_terms (e.g., "TODO, TBD").
  • CSENSE007: Validates that cref attributes in documentation point to valid symbols.

Parameters & Type Parameters

Ensures the <param> and <typeparam> tags match the method signature exactly.

  • CSENSE002 / CSENSE004: Flags parameters or type parameters defined in code but missing from documentation.
  • CSENSE003 / CSENSE005: Flags "stray" tags referring to parameters that do not exist.
  • CSENSE008 / CSENSE010: Enforces that the order of parameter tags in documentation matches the method signature.
  • CSENSE009 / CSENSE011: Flags duplicate tags for the same parameter.

Return Values

  • CSENSE006: Requires a <returns> tag for members that return a value (i.e., non-void, non-Task, non-ValueTask).
  • CSENSE013: Flags stray <returns> tags on members that do not produce a documented return value (including void, Task, and ValueTask members), as well as on properties and indexers.

Exceptions

  • CSENSE012: Scans the method body for explicitly thrown exceptions and ensures they are documented with <exception> tags.
    • Configurable: Ignore specific exception types using comment_sense.ignored_exceptions.
  • CSENSE017: Validates that the cref attribute in an <exception> tag refers to a valid Exception type.

Properties

  • CSENSE014: Requires a <value> tag for properties.
    • Default: Disabled.
  • CSENSE015: Flags stray <value> tags.

Configuration

You can configure the analyzer behavior using an .editorconfig file in your project root or solution directory.

Low Quality Terms

Specify a comma-separated list of terms that are considered "low quality" in summaries, parameters, or return value descriptions.

[*.cs]
comment_sense.low_quality_terms = TODO, TBD, FixMe

Ignored Exceptions

Specify a comma-separated list of exception types (by name or full name) that should be ignored by the missing exception documentation rule.

[*.cs]
comment_sense.ignored_exceptions = System.ArgumentNullException, ArgumentOutOfRangeException

Internal Member Analysis

Enable analysis for internal and private protected members (disabled by default).

[*.cs]
comment_sense.analyze_internal = true

Contributions

Contributions are welcome! Read the contributing guide to get started.

License

This project is licensed under the MIT License.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.3.0 32 2/6/2026
0.3.0-rc.2 46 2/6/2026
0.3.0-rc.1 51 2/5/2026
0.2.0 114 2/1/2026
0.2.0-rc.2 43 2/1/2026
0.2.0-rc.1 46 1/31/2026
0.1.0 91 1/30/2026
0.1.0-rc.3 43 1/30/2026
0.1.0-rc.2 42 1/28/2026