56 lines
1.4 KiB
Plaintext
56 lines
1.4 KiB
Plaintext
== Why is this an issue?
|
|
|
|
:operationName: method
|
|
:emptyCode: csharp/empty-code.adoc
|
|
:notsupportedCode: csharp/notsupported-code.adoc
|
|
:notimplementedCode: csharp/notimplemented-code.adoc
|
|
:commentCode: csharp/comment-code.adoc
|
|
|
|
include::../why-dotnet.adoc[]
|
|
|
|
=== Exceptions
|
|
|
|
The following empty methods are considered compliant:
|
|
|
|
* empty `virtual` methods as the implementation might not be required in the base class
|
|
* empty methods that override an `abstract` method as the implementation is mandatory for child class
|
|
* empty overrides in test assemblies for mocking purposes
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 11 Nov 2020, 19:45:36 Andrei Epure wrote:
|
|
\[~nicolas.harraudeau] I believe this rule could also apply to local functions and to property setters, right?
|
|
|
|
----
|
|
public void Method()
|
|
{
|
|
void EmptyLocalFunction {} // Noncompliant
|
|
}
|
|
|
|
public int Property
|
|
{
|
|
set {} // Noncompliant
|
|
}
|
|
{code}
|
|
----
|
|
|
|
=== on 16 Nov 2020, 14:19:07 Nicolas Harraudeau wrote:
|
|
\[~andrei.epure] Yes. We already do it for nested functions in python. I don't see any reason to not do the same for C#.
|
|
|
|
=== on 16 Nov 2020, 17:39:11 Andrei Epure wrote:
|
|
thanks. I opened \https://github.com/SonarSource/sonar-dotnet/issues/3753 for this.
|
|
|
|
include::../comments-and-links.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|