rspec/rules/S1481/java/rule.adoc

41 lines
695 B
Plaintext
Raw Normal View History

include::../rationale.adoc[]
include::../how-to-fix-it.adoc[]
2020-06-30 12:47:33 +02:00
=== Code examples
2020-06-30 12:47:33 +02:00
==== Noncompliant code example
[source,java,diff-id=1,diff-type=noncompliant]
2020-06-30 12:47:33 +02:00
----
public int numberOfMinutes(int hours) {
int seconds = 0; // Noncompliant - seconds is unused
2020-06-30 12:47:33 +02:00
return hours * 60;
}
----
==== Compliant solution
2020-06-30 12:47:33 +02:00
[source,java,diff-id=1,diff-type=compliant]
2020-06-30 12:47:33 +02:00
----
public int numberOfMinutes(int hours) {
return hours * 60;
}
----
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[]