
When an include is not surrounded by empty lines, its content is inlined on the same line as the adjacent content. That can lead to broken tags and other display issues. This PR fixes all such includes and introduces a validation step that forbids introducing the same problem again.
53 lines
1.5 KiB
Plaintext
53 lines
1.5 KiB
Plaintext
== Why is this an issue?
|
|
|
|
There is no good excuse for an empty class. If it's being used simply as a common extension point, it should be replaced with an ``++Interface++``. If it was stubbed in as a placeholder for future development it should be fleshed-out. In any other case, it should be eliminated.
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,vbnet]
|
|
----
|
|
Public Class Empty ' Noncompliant
|
|
|
|
End Class
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,vbnet]
|
|
----
|
|
Public Interface IEmpty
|
|
|
|
End Interface
|
|
----
|
|
|
|
=== Exceptions
|
|
|
|
Partial classes are ignored entirely, as they are often used with Source Generators.
|
|
Subclasses of System.Exception are ignored, as even an empty Exception class can provide useful information by its type name alone.
|
|
Subclasses of System.Attribute are ignored, as well as classes which are annotated with attributes.
|
|
Subclasses of generic classes are ignored, as even when empty they can be used for type specialization.
|
|
Subclasses of certain framework types - like the PageModel class used in ASP.NET Core Razor Pages - are also ignored.
|
|
[source,vbnet]
|
|
----
|
|
Imports Microsoft.AspNetCore.Mvc.RazorPages
|
|
|
|
Public Class EmptyPageModel ' Compliant - an empty PageModel can be fully functional, the VB code can be in the vbhtml file
|
|
Inherits PageModel
|
|
End Class
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
|
|
endif::env-github,rspecator-view[] |