Skip to content

Verify if xml docs have the correct parameters #357

@giggio

Description

@giggio

As fixed on 526aa91.

Should work on methods and constructors.
Diagnostic should only be raised if there is already some xml documentation present.

Removing unexistent param:

Before (spans does not exist):

         /// </summary>
         /// <param name="analyzer">The analyzer to run on the documents</param>
         /// <param name="documents">The Documents that the analyzer will be run on</param>
         /// <param name="spans">Optional TextSpan indicating where a Diagnostic will be found</param>
         /// <returns>An IEnumerable of Diagnostics that surfaced in teh source code, sorted by Location</returns>
         protected async static Task<Diagnostic[]> GetSortedDiagnosticsFromDocumentsAsync(DiagnosticAnalyzer analyzer, Document[] documents)
         {

After:

         /// </summary>
         /// <param name="analyzer">The analyzer to run on the documents</param>
         /// <param name="documents">The Documents that the analyzer will be run on</param>
         /// <returns>An IEnumerable of Diagnostics that surfaced in teh source code, sorted by Location</returns>
         protected async static Task<Diagnostic[]> GetSortedDiagnosticsFromDocumentsAsync(DiagnosticAnalyzer analyzer, Document[] documents)
         {

Creating a missing parameter:

Before (note that workspace does not appear on the xml docs):

         /// </summary>
         /// <param name="sources">Classes in the form of strings</param>
         /// <param name="language">The language the source code is in</param>
         /// <returns>A Project created out of the Douments created from the source strings</returns>
         public static Project CreateProject(string[] sources,
             out AdhocWorkspace workspace, string language = LanguageNames.CSharp)

After (with workspace):

         /// </summary>
         /// <param name="sources">Classes in the form of strings</param>
         /// <param name="language">The language the source code is in</param>
         /// <param name="workspace">todo: describe workspace parameter on CreateProject</param>
         /// <returns>A Project created out of the Douments created from the source strings</returns>
         public static Project CreateProject(string[] sources,
             out AdhocWorkspace workspace, string language = LanguageNames.CSharp)

When including a parameter leave the description in the format:

todo: describe {parameter} parameter on {method}

The code actions listed should be:

  • One for each missing parameter
  • One for all parameters that are missing

Severity: Warning
Diagnostic id: CC0090
Category: Maintenability

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions