INNER CODE UNIT · Kotlin

writeCheckstyleReport

MovingBlocks/Terasology · build-logic/src/main/kotlin/org/terasology/gradology/ValidateJsonAssets.kt:230

    private fun writeCheckstyleReport(findings: Map<File, List<Pair<String, String>>>) {
        val reportFile = report.get().asFile
        reportFile.parentFile.mkdirs()
        reportFile.writeText(buildString {
            appendLine("""<?xml version="1.0" encoding="UTF-8"?>""")
            appendLine("""<checkstyle version="8.0">""")
            findings.forEach { (file, entries) ->
                appendLine("""  <file name="${xmlAttr(file.path)}">""")
                entries.forEach { (severity, message) ->
                    appendLine(
                        """    <error line="0" severity="$severity" """ +
                            """message="${xmlAttr(message)}" source="JsonAssets" />"""
                    )
                }
                appendLine("  </file>")
            }
            appendLine("</checkstyle>")
        })

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…