Skip to content

Commit

Permalink
Merge pull request #208 from nxtstep/fix-input-paths
Browse files Browse the repository at this point in the history
Allow for file paths on the input argument (not only directories)
  • Loading branch information
Ozsie authored Nov 1, 2023
2 parents d1a2368 + 3d5b10f commit adc8b79
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main/java/com/github/ozsie/CheckMojo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ class CheckMojo : DetektMojo() {
log.debug("Applying $it")
}
val cliArgs = parseArguments(getCliSting().log().toTypedArray())
val invalidInputDirs = input.split(",").mapNotNull {
if (!Files.isDirectory(Paths.get(it))) it else null
val invalidInputs = input.split(",").filter {
val path = Paths.get(it)
!Files.isDirectory(Paths.get(it)) && !Files.exists(path)
}
if (!skip && invalidInputDirs.isEmpty())
if (!skip && invalidInputs.isEmpty())
failBuildIfNeeded { Runner(cliArgs, System.out, System.err).execute() }
else
inputSkipLog(skip, invalidInputDirs)
inputSkipLog(skip, invalidInputs)
}

private fun failBuildIfNeeded(block: () -> Unit) {
Expand Down

0 comments on commit adc8b79

Please sign in to comment.