
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.
69 lines
1.3 KiB
Plaintext
69 lines
1.3 KiB
Plaintext
== Why is this an issue?
|
|
|
|
When a derived type is used as a parameter instead of the base type, it limits the uses of the method. If the additional functionality that is provided in the derived type is not required then that limitation isn't required, and should be removed.
|
|
|
|
|
|
This rule raises an issue when a method declaration includes a parameter that is a derived type and accesses only members of the base type.
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,csharp]
|
|
----
|
|
using System;
|
|
using System.IO;
|
|
|
|
namespace MyLibrary
|
|
{
|
|
public class Foo
|
|
{
|
|
public void ReadStream(FileStream stream) // Noncompliant: Uses only System.IO.Stream methods
|
|
{
|
|
int a;
|
|
while ((a = stream.ReadByte()) != -1)
|
|
{
|
|
// Do something.
|
|
}
|
|
}
|
|
}
|
|
}
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,csharp]
|
|
----
|
|
using System;
|
|
using System.IO;
|
|
|
|
namespace MyLibrary
|
|
{
|
|
public class Foo
|
|
{
|
|
public void ReadStream(Stream stream)
|
|
{
|
|
int a;
|
|
while ((a = stream.ReadByte()) != -1)
|
|
{
|
|
// Do something.
|
|
}
|
|
}
|
|
}
|
|
}
|
|
----
|
|
|
|
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[]
|