com.avito.android.diff.report.file.FileOwnersDiffReporter.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of code-ownership Show documentation
Show all versions of code-ownership Show documentation
Collection of infrastructure libraries and gradle plugins of Avito Android project
The newest version!
package com.avito.android.diff.report.file
import com.avito.android.diff.formatter.OwnersDiffMessageFormatter
import com.avito.android.diff.model.OwnersDiff
import com.avito.android.diff.report.OwnersDiffReporter
import java.io.File
public class FileOwnersDiffReporter(
private val parentDir: File,
private val messageFormatter: OwnersDiffMessageFormatter
) : OwnersDiffReporter {
override fun reportDiffFound(diffs: OwnersDiff) {
if (diffs.isEmpty()) return
val file = File(parentDir, "ownership_diff_report.txt").apply {
if (exists()) delete()
createNewFile()
}
val formattedOwners = messageFormatter.formatDiffMessage(diffs)
file.appendText(formattedOwners)
}
}