DotNetAnalyzers / DocumentationAnalyzers

Analyzers for XML documentation
MIT License
35 stars 6 forks source link

DOC210/DOC211: Highlight invalid usages of <returns> #74

Open drewnoakes opened 5 years ago

drewnoakes commented 5 years ago

I don't think there's a valid reason to have a <returns> element on a void typed member:

/// <returns>Nothing at all!</returns>
public void Foo();

Nor on a type:

/// <returns>Nothing at all!</returns>
public class Foo { }

Nor on a field:

/// <returns>Nothing at all!</returns>
private int _foo;
sharwell commented 5 years ago

There are two issues here, likely with distinct diagnostic IDs:

  1. DOC210: Use <value> instead of <returns> (applies to fields and properties)
  2. DOC211: Element does not have a value (everything else)
drewnoakes commented 5 years ago

Does <returns> make sense on a non-void-returning delegate declaration?