Replace some if-statements with if-expressions (#168)

This commit is contained in:
translatenix
2024-02-16 05:41:41 -08:00
committed by GitHub
parent 0405db8d80
commit 3b2feb45cf

View File

@@ -76,9 +76,10 @@ abstract class CliCommand(protected val cliOptions: CliBaseOptions) {
/** The Project used by this command. */ /** The Project used by this command. */
protected val project: Project? by lazy { protected val project: Project? by lazy {
if (cliOptions.noProject) { if (cliOptions.noProject) {
return@lazy null null
} else {
cliOptions.normalizedProjectFile?.let { loadProject(it) }
} }
cliOptions.normalizedProjectFile?.let { loadProject(it) }
} }
protected fun loadProject(projectFile: Path): Project { protected fun loadProject(projectFile: Path): Project {
@@ -103,10 +104,7 @@ abstract class CliCommand(protected val cliOptions: CliBaseOptions) {
} }
private val projectSettings: Project.EvaluatorSettings? by lazy { private val projectSettings: Project.EvaluatorSettings? by lazy {
if (cliOptions.omitProjectSettings) { if (cliOptions.omitProjectSettings) null else project?.settings
return@lazy null
}
project?.settings
} }
protected val allowedModules: List<Pattern> by lazy { protected val allowedModules: List<Pattern> by lazy {