Scala

Scala

Made by DeepSource

If condition depends on boolean value that is a compile time constant SC-W1022

Bug risk
Major

The specified if condition depends on a boolean value that is a constant and changes neither at compile-time nor at runtime. This is likely due to a human error and is expected that this constant value is replaced with an appropriate condition that can be evaluated as necessary. Without this fix, it is expected that this if condition can potentially alter the logic of your program, thus affecting the overall behavior of your program.

Bad practice

if (true) {
  // do something
}

if (false) {
  // do something
}

Recommended

if (/* some condition */) {
  // do something
}