From ba49f996df46cc9aefc77d74a55b70f08344eb6f Mon Sep 17 00:00:00 2001 From: Matthew Haughton <3flex@users.noreply.github.com> Date: Sat, 2 Jan 2021 16:57:49 +1100 Subject: [PATCH] Fail CLI execution when unknown option provided --- .../github/detekt/compiler/plugin/DetektCommandLineProcessor.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/kotlin/io/github/detekt/compiler/plugin/DetektCommandLineProcessor.kt b/src/main/kotlin/io/github/detekt/compiler/plugin/DetektCommandLineProcessor.kt index f12faa6..4fd0dba 100644 --- a/src/main/kotlin/io/github/detekt/compiler/plugin/DetektCommandLineProcessor.kt +++ b/src/main/kotlin/io/github/detekt/compiler/plugin/DetektCommandLineProcessor.kt @@ -3,6 +3,7 @@ package io.github.detekt.compiler.plugin import io.github.detekt.gradle.DETEKT_COMPILER_PLUGIN import org.jetbrains.kotlin.compiler.plugin.AbstractCliOption import org.jetbrains.kotlin.compiler.plugin.CliOption +import org.jetbrains.kotlin.compiler.plugin.CliOptionProcessingException import org.jetbrains.kotlin.compiler.plugin.CommandLineProcessor import org.jetbrains.kotlin.config.CompilerConfiguration import java.io.ByteArrayInputStream @@ -83,6 +84,7 @@ class DetektCommandLineProcessor : CommandLineProcessor { Options.rootPath -> configuration.put(Keys.ROOT_PATH, Paths.get(value)) Options.excludes -> configuration.put(Keys.EXCLUDES, value.decodeToGlobSet()) Options.report -> configuration.put(Keys.REPORTS, value.substringBefore(':'), Paths.get(value.substringAfter(':'))) + else -> throw CliOptionProcessingException("Unknown option: ${option.name}") } } }