Skip to content

Commit

Permalink
Only set disabled_rules in userData if not empty (#539)
Browse files Browse the repository at this point in the history
Fixes #538
  • Loading branch information
shashachu authored Jul 23, 2019
1 parent de89c5e commit f7fc4eb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ktlint/src/main/kotlin/com/pinterest/ktlint/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,10 @@ class KtlintCommandLine {
val tripped = AtomicBoolean()
val reporter = loadReporter(dependencyResolver) { tripped.get() }
data class LintErrorWithCorrectionInfo(val err: LintError, val corrected: Boolean)
val userData = mapOf("android" to android.toString(), "disabled_rules" to disabledRules)
val userData = listOfNotNull(
"android" to android.toString(),
if (disabledRules.isNotBlank()) "disabled_rules" to disabledRules else null
).toMap()

fun process(fileName: String, fileContent: String): List<LintErrorWithCorrectionInfo> {
if (debug) {
Expand Down

0 comments on commit f7fc4eb

Please sign in to comment.