rspec/rules/S1066/scala/rule.adoc

29 lines
464 B
Plaintext
Raw Normal View History

2020-06-30 12:47:33 +02:00
include::../description.adoc[]
== Noncompliant Code Example
----
if (file != null) {
if (file.isFile || file.isDirectory) {
/* ... */
}
}
----
== Compliant Solution
----
if (file != null && isFileOrDirectory(file)) {
/* ... */
}
def isFileOrDirectory(file: File): Boolean = file.isFile || file.isDirectory
----
ifdef::rspecator-view[]
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::rspecator-view[]