Enforces XML documentation on public members.

This commit is contained in:
BinaryAlley committed 2026-11-16 20:16:23 +02:00
1 parent 0daef2acab
commit 308402ad0e
202 files changed
+3901 -98

No files matched your search

+4 -4
View File
@@ -19,7 +19,7 @@
- Contributors are expected to add themselves to the list at the end of this file.
## Documentation Standards
- **Every** construct (class, interface, struct, record, method, property, etc.) should have documentation. For example:
- **Every** construct (class, interface, struct, record, method, property, etc.) should have documentation. Every production project generates an XML documentation file and treats a missing XML comment on a publicly visible member (CS1591) as an error, so undocumented public API fails the build. For example:
```csharp
/// <summary>
/// Represents a user in the application.
@@ -41,7 +41,7 @@ public class User
}
/// <summary>
/// Query for getting a user identified by <param name="UserId">.
/// Query for getting a user identified by <paramref name="UserId"/>.
/// </summary>
/// <param name="UserId">The id of the user to get.</param>
public record GetUserQuery(int UserId);
@@ -68,14 +68,14 @@ public enum ThemeStyle
public interface IUserService
{
/// <summary>
/// Gets a user identified by <param name="userId">.
/// Gets a user identified by <paramref name="userId"/>.
/// </summary>
/// <param name="userId">The unique identifier of the user.</param>
/// <returns>The user associated with the specified identifier.</returns>
User GetUserById(Guid userId);
/// <summary>
/// Updates the profile of the specified <param name="user">.
/// Updates the profile of the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user object containing updated information.</param>
void UpdateUserProfile(User user);
@@ -30,7 +30,7 @@ This project enforces many style rules via `.editorconfig` as build errors, so t
- **Naming quality**: names must be explicit, even if long. Domain names must match the project's Ubiquitous Language exactly. Lambda parameters must be named descriptively, never single letters or shortened anti-pattern names (no `x`, `e`, `s`, etc).
- **Domain nullability**: domain code must never use nullable value types or reference nulls directly, it must use the `Optional<T>` and `Result<T>` types instead. Flag any raw `null`/`?` usage in domain code.
- **Comments**: should explain *why*, not *what* (the code already shows what). Wrap only when substantially exceeding a 1920px monitor's width. Flag comments that just restate the code. Comment text is written as a sentence: the first word is capitalized and the sentence ends with a period, in every code file the repository contains (C#, JavaScript, CSS, Razor, HTML, MSBuild/XML, SVG, YAML, Dockerfiles, and the bundled theme archives). Generated files (`*.Designer.cs`, `*ModelSnapshot.cs`, `AssemblyInfo.cs`) and tool configuration files (`.editorconfig`, `.gitignore`) are excluded. Section labels and marker comments follow the same rule, except the `// Arrange`, `// Act` and `// Assert` markers, which are always written bare, without a period. `TODO`, `FIXME`, `HACK`, `XXX` and `NOTE` already provide the capitalized first word, so the body after the colon is written in lowercase, unless it starts with a proper noun or a code identifier. Commented-out code is not prose and is left exactly as written.
- **XML documentation**: required on every public construct, and also on private properties and methods. Use `<see langword="etc"/>` for language keywords, not `<c>etc</c>`. Method summaries must not expose internal implementation details, unless truly relevant, in which case put that detail in a `<remarks>` block instead of the summary.
- **XML documentation**: required on every public construct, and also on private properties and methods. Every production project generates an XML documentation file and treats CS1591 as an error, so an undocumented publicly visible member fails the build; private properties and methods remain a review rule. Use `<see langword="etc"/>` for language keywords, not `<c>etc</c>`. Method summaries must not expose internal implementation details, unless truly relevant, in which case put that detail in a `<remarks>` block instead of the summary.
- **`<inheritdoc/>`**: avoid on classes implementing interface members. Developers usually work in the implementing class and should see documentation there directly, without having to open the interface.
- **Boolean naming**: boolean fields, properties, and methods returning booleans must start with a verb implying true/false: `is`, `are`, `should`, `has`, `was`, `can`, etc.
- **Error handling**: rule violations return `Result<T>`. Never throw exceptions unless explicitly justified (e.g. startup/configuration code). Flag any `throw` outside that context.