报告 if 语句中的 isEmptyisBlankisNotEmptyisNotBlank 调用以赋予默认值。

快速修复将 if 条件替换为 ifEmptyifBlank 调用。

示例:


  fun test(list: List<Int>): List<Int> {
      return if (list.isEmpty()) {
          println()
          foo()
      } else {
          list
      }
  }

在应用快速修复后:


  fun test(list: List<Int>): List<Int> {
      return list.ifEmpty {
          println()
          foo()
      }
  }

此检查仅报告项目或模块的 Kotlin 语言版本是否为 1.3 或更高版本。