Add CT0012: require XML summary on Azure Function classes#23
Merged
Conversation
Adds a new analyzer rule (CT0012) that mirrors CT0006 for plugins. Classes containing methods decorated with [Function] (isolated worker model, Microsoft.Azure.Functions.Worker) or [FunctionName] (in-process model, Microsoft.Azure.WebJobs) must have a non-empty XML <summary> comment or an <inheritdoc> tag on the class. - AzureFunctionDocumentationAnalyzer.cs: new analyzer - Resources.resx / Resources.Designer.cs: CT0012 strings - AzureFunctionDocumentationAnalyzerTests.cs: 14 test cases Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The existing CT0006 rule enforces XML
<summary>documentation on Dataverse plugin classes. Azure Function classes benefit from the same discipline — without it, there's no at-a-glance description of what a function class does, making the codebase harder to navigate.What
Adds CT0012 (
AzureFunctionDocumentationAnalyzer), aDiagnosticSeverity.Warningrule in theDocumentationcategory. It fires on any class that contains a method decorated with:[Function("...")]— isolated worker model (Microsoft.Azure.Functions.Worker)[FunctionName("...")]— in-process model (Microsoft.Azure.WebJobs)…and lacks either a non-empty XML
<summary>or an<inheritdoc>tag on the class declaration. The diagnostic message includes the class name for easy identification.Classes with no Azure Function trigger methods are unaffected, as are classes whose
[Function]/[FunctionName]attributes come from an unrelated namespace.Tests
14 new test cases in
AzureFunctionDocumentationAnalyzerTestscover:<inheritdoc>with and withoutcref→ no trigger<remarks>-only (no<summary>) → trigger[FunctionName](in-process model) → same behaviourAll 146 tests pass (132 pre-existing + 14 new).