rspec/rules/S2205/rule.adoc

24 lines
300 B
Plaintext
Raw Normal View History

It is simpler and clearer to return a variable than it is to test the variable and then return its value as a literal.
== Noncompliant Code Example
2022-02-04 17:28:24 +01:00
[source,text]
----
if (var == null) {
return null;
}
return var;
}
----
== Compliant Solution
2022-02-04 17:28:24 +01:00
[source,text]
----
return var;
}
----