Skip to content

Commit

Permalink
Properly handle --stdin flag for printAST command
Browse files Browse the repository at this point in the history
* Fixes #528
* Also properly pass through `--debug` flag from `printAST` command
* Small cleanup of unused variable
  • Loading branch information
shashachu committed Jul 16, 2019
1 parent d1a3f71 commit 5e55e7b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions ktlint/src/main/kotlin/com/pinterest/ktlint/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,6 @@ class KtlintCommandLine {
@Parameters(hidden = true)
private var patterns = ArrayList<String>()

private val workDir = File(".").canonicalPath

fun run() {
if (apply || applyToProject) {
applyToIDEA()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ internal class PrintASTSubCommand : Runnable {
}

try {
lintFile(fileName, fileContent, astRuleSet)
lintFile(fileName, fileContent, astRuleSet, debug = ktlintCommand.debug)
} catch (e: Exception) {
if (e is ParseException) {
throw ParseException(e.line, e.col, "Not a valid Kotlin file (${e.message?.toLowerCase()})")
Expand All @@ -77,6 +77,6 @@ internal class PrintASTSubCommand : Runnable {

companion object {
internal const val COMMAND_NAME = "printAST"
private const val STDIN_FILE = "<stdin>"
private const val STDIN_FILE = "<text>"
}
}

0 comments on commit 5e55e7b

Please sign in to comment.