rspec/rules/S1481/scala/rule.adoc

44 lines
724 B
Plaintext
Raw Permalink Normal View History

include::../rationale.adoc[]
include::../how-to-fix-it.adoc[]
=== Code examples
==== Noncompliant code example
[source,scala,diff-id=1,diff-type=noncompliant]
----
def numberOfMinutes(hours: Int): Int = {
var seconds = 0 // Noncompliant - seconds is unused
val result = hours * 60
result
}
----
==== Compliant solution
[source,scala,diff-id=1,diff-type=compliant]
----
def numberOfMinutes(hours: Int): Int = {
val result = hours * 60
result
}
----
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[]