Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
Fail CLI execution when unknown option provided
Browse files Browse the repository at this point in the history
  • Loading branch information
3flex committed Jan 2, 2021
1 parent 3358fa6 commit 60e1770
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.optionName}")
}
}
}
Expand Down

0 comments on commit 60e1770

Please sign in to comment.