rspec/rules/S1066/scala/rule.adoc

30 lines
490 B
Plaintext

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::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]