Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow for multiple comma-separated inputs in check-with-type-resolution #214

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions src/main/java/com/github/ozsie/CheckWithTypeResolutionMojo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ open class CheckWithTypeResolutionMojo : DetektMojo() {
log.debug("Applying $it")
}
this.cliArgs = parseArguments(getCliSting().log().toTypedArray())

val foundInputDir = Files.isDirectory(Paths.get(input))
if (!skip && foundInputDir) {
val invalidInputs = input.split(",").filter {
val path = Paths.get(it)
!Files.isDirectory(Paths.get(it)) && !Files.exists(path)
}
Ozsie marked this conversation as resolved.
Show resolved Hide resolved
if (!skip && invalidInputs.isEmpty()) {
setDefaultClasspathIfNotSet(cliArgs)
failBuildIfNeeded { Runner(cliArgs, System.out, System.err).execute() }
} else
inputSkipLog(skip)
inputSkipLog(skip, invalidInputs)
}

private fun setDefaultClasspathIfNotSet(cliArgs: CliArgs) {
Expand All @@ -50,8 +52,12 @@ open class CheckWithTypeResolutionMojo : DetektMojo() {
}
}

private fun inputSkipLog(skip: Boolean) {
if (skip) log.info("Skipping execution") else log.info("Input directory '$input' not found, skipping module")
private fun inputSkipLog(skip: Boolean, invalidInputDirs: List<String>) {
if (skip) {
log.info("Skipping execution")
} else {
log.info("Failed to resolve input directories '${invalidInputDirs.joinToString()}', skipping module")
}
}
Ozsie marked this conversation as resolved.
Show resolved Hide resolved
}

Expand Down
Loading