rspec/rules/S1186/go/rule.adoc

60 lines
1.0 KiB
Plaintext
Raw Normal View History

== Why is this an issue?
:operationName: function
2020-06-30 12:47:33 +02:00
include::../description.adoc[]
== How to fix it
=== Code examples
==== Noncompliant code example
2020-06-30 12:47:33 +02:00
[source,go,diff-id=1,diff-type=noncompliant]
2020-06-30 12:47:33 +02:00
----
func shouldNotBeEmpty() { // Noncompliant - method is empty
}
func notImplemented() { // Noncompliant - method is empty
}
func emptyOnPurpose() { // Noncompliant - method is empty
2020-06-30 12:47:33 +02:00
}
----
==== Compliant solution
2020-06-30 12:47:33 +02:00
[source,go,diff-id=1,diff-type=compliant]
2020-06-30 12:47:33 +02:00
----
func shouldNotBeEmpty() {
doSomething();
}
func notImplemented() {
return "", errors.New("notImplemented() cannot be performed because ...")
}
func emptyOnPurpose() {
// comment explaining why the method is empty
2020-06-30 12:47:33 +02:00
}
----
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[]