Pattern: Missing use of parentheses in for
loop
Issue: -
For-comprehensions which lack a yield
clause is actually a loop rather than a functional comprehension and it is usually more readable to string the generators together between parentheses rather than using the syntactically-confusing } {
construct:
for (x <- board.rows; y <- board.files) {
printf("(%d, %d)", x, y)
}
is preferred to
for {
x <- board.rows
y <- board.files
} {
printf("(%d, %d)", x, y)
}
<check enabled="true" class="org.scalastyle.scalariform.ForLoopChecker" level="warning"/>