rspec/rules/S927/csharp/rule.adoc
Arseniy Zaostrovnykh 11c08de44a
Revert "RULEAPI-665: Remove security standards from the irrelevant language-specific rules" (#361)
This reverts commit 892bccde8ffcdf2a6d662d97ec469cd63de87878.
2021-09-17 13:50:03 +02:00

78 lines
1.1 KiB
Plaintext

The name of a parameter in an externally visible. This rule raises an issue when method override does not match the name of the parameter in the base declaration of the method, or the name of the parameter in the interface declaration of the method or the name of any other ``++partial++`` definition.
== Noncompliant Code Example
----
partial class Point
{
partial void MoveVertically(int z);
}
partial class Point
{
int x = 0;
int y = 0;
int z = 0;
partial void MoveVertically(int y) // Noncompliant
{
this.y = y;
}
}
interface IFoo
{
void Bar(int i);
}
class Foo : IFoo
{
void Bar(int z) // Noncompliant, parameter name should be i
{
}
}
----
== Compliant Solution
----
partial class Point
{
partial void MoveVertically(int z);
}
partial class Point
{
int x = 0;
int y = 0;
int z = 0;
partial void MoveVertically(int z)
{
this.z = z;
}
}
interface IFoo
{
void Bar(int i);
}
class Foo : IFoo
{
void Bar(int i)
{
}
}
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]