64 lines
1.1 KiB
Plaintext
Raw Normal View History

== Why is this an issue?
2020-06-30 12:47:33 +02:00
include::../description.adoc[]
== How to fix it
include::../how-to-fix.adoc[]
=== Code examples
==== Noncompliant code example
2020-06-30 12:47:33 +02:00
[source,js,diff-id=1,diff-type=noncompliant]
2020-06-30 12:47:33 +02:00
----
function computeDurationInMilliseconds(hours, minutes, seconds) {
const duration = (((hours * 60) + minutes) * 60 + seconds) * 1000;
2020-06-30 12:47:33 +02:00
return duration;
}
----
==== Compliant solution
2020-06-30 12:47:33 +02:00
[source,js,diff-id=1,diff-type=compliant]
2020-06-30 12:47:33 +02:00
----
function computeDurationInMilliseconds(hours, minutes, seconds) {
return (((hours * 60) + minutes) * 60 + seconds) * 1000;
2020-06-30 12:47:33 +02:00
}
----
==== Noncompliant code example
[source,js,diff-id=2,diff-type=noncompliant]
----
function doSomething() {
const myError = new Error();
throw myError;
}
----
==== Compliant solution
[source,js,diff-id=2,diff-type=compliant]
----
function doSomething() {
throw new Error();
}
----
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[]