rspec/rules/S1005/flex/rule.adoc

45 lines
613 B
Plaintext
Raw Normal View History

== Why is this an issue?
2020-06-30 12:47:33 +02:00
include::../description.adoc[]
=== Noncompliant code example
2020-06-30 12:47:33 +02:00
2022-02-04 17:28:24 +01:00
[source,flex]
2020-06-30 12:47:33 +02:00
----
function func1() { // Noncompliant - there are two points of exit
if (false) {
return;
}
}
function func2() { // Noncompliant - there are two points of exit
if (a > 0) {
return 0;
}
return -1;
}
----
=== Compliant solution
2020-06-30 12:47:33 +02:00
2022-02-04 17:28:24 +01:00
[source,flex]
2020-06-30 12:47:33 +02:00
----
function func1() {
return;
}
function func2() {
}
function func3();
----
ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]