rspec/rules/S1488/java/rule.adoc
2020-06-30 17:16:12 +02:00

28 lines
524 B
Plaintext

include::../description.adoc[]
== Noncompliant Code Example
----
public long computeDurationInMilliseconds() {
long duration = (((hours * 60) + minutes) * 60 + seconds ) * 1000 ;
return duration;
}
public void doSomething() {
RuntimeException myException = new RuntimeException();
throw myException;
}
----
== Compliant Solution
----
public long computeDurationInMilliseconds() {
return (((hours * 60) + minutes) * 60 + seconds ) * 1000 ;
}
public void doSomething() {
throw new RuntimeException();
}
----