diff --git a/mozilla-detekt-rules/src/main/java/org/mozilla/fenix/detektrules/CustomRulesetConsoleReport.kt b/mozilla-detekt-rules/src/main/java/org/mozilla/fenix/detektrules/CustomRulesetConsoleReport.kt index 8bd04971b8..8266688bfa 100644 --- a/mozilla-detekt-rules/src/main/java/org/mozilla/fenix/detektrules/CustomRulesetConsoleReport.kt +++ b/mozilla-detekt-rules/src/main/java/org/mozilla/fenix/detektrules/CustomRulesetConsoleReport.kt @@ -1,13 +1,21 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + package org.mozilla.fenix.detektrules import io.gitlab.arturbosch.detekt.api.ConsoleReport import io.gitlab.arturbosch.detekt.api.Detektion +/** + * A reporter that custom formats violations of our custom lint rules. + */ class CustomRulesetConsoleReport : ConsoleReport() { - @Suppress("DEPRECATION") + @Suppress("DEPRECATION") // locationAsString override fun render(detektion: Detektion): String? { - return detektion.findings["mozilla-detekt-rules"]?.fold("") { output, finding -> - output + finding.locationAsString + ": " + finding.messageOrDescription() + return detektion.findings["mozilla-detekt-rules"]?.fold("") { accumulator, finding -> + accumulator + "${finding.id}:\n ${finding.locationAsString}\n ${finding.messageOrDescription()}\n\n" + // This creates an extra newline at the very end but it's not worth fixing. } } } \ No newline at end of file