rspec/rules/S1186/kotlin/rule.adoc

57 lines
970 B
Plaintext
Raw Normal View History

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