DeepSource has joined Harness. Learn more
Scala logoScala/
SC-W1022

`If` condition depends on `boolean` value that is a compile time constantSC-W1022

Major severityMajor
Bug Risk categoryBug Risk

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
}
if (/* some condition */) {
  // do something
}