
## Review A dedicated reviewer checked the rule description successfully for: - [ ] logical errors and incorrect information - [ ] information gaps and missing content - [ ] text style and tone - [ ] PR summary and labels follow [the guidelines](https://github.com/SonarSource/rspec/#to-modify-an-existing-rule)
60 lines
1.0 KiB
Plaintext
60 lines
1.0 KiB
Plaintext
== Why is this an issue?
|
|
|
|
:operationName: function
|
|
|
|
include::../description.adoc[]
|
|
|
|
== How to fix it
|
|
|
|
=== Code examples
|
|
|
|
==== Noncompliant code example
|
|
|
|
[source,go,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
func shouldNotBeEmpty() { // Noncompliant - method is empty
|
|
}
|
|
|
|
func notImplemented() { // Noncompliant - method is empty
|
|
}
|
|
|
|
func emptyOnPurpose() { // Noncompliant - method is empty
|
|
}
|
|
----
|
|
|
|
==== Compliant solution
|
|
|
|
[source,go,diff-id=1,diff-type=compliant]
|
|
----
|
|
func shouldNotBeEmpty() {
|
|
doSomething();
|
|
}
|
|
|
|
func notImplemented() {
|
|
return "", errors.New("notImplemented() cannot be performed because ...")
|
|
}
|
|
|
|
func emptyOnPurpose() {
|
|
// comment explaining why the method is empty
|
|
}
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Add a nested comment explaining why this function is empty or complete the implementation.
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|