{"id":13684555,"url":"https://github.com/appsynth-org/danger-kotlin-jacoco","last_synced_at":"2026-01-11T17:48:13.921Z","repository":{"id":40676649,"uuid":"486846411","full_name":"appsynth-org/danger-kotlin-jacoco","owner":"appsynth-org","description":"Plugin for danger-kotlin that reads JaCoCo reports and posts summary as PR comments","archived":false,"fork":false,"pushed_at":"2022-08-09T05:14:08.000Z","size":103,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-08-03T14:07:45.111Z","etag":null,"topics":["danger","danger-kotlin","jacoco"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/appsynth-org.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-29T05:18:00.000Z","updated_at":"2022-06-01T07:46:11.000Z","dependencies_parsed_at":"2022-08-25T07:50:23.786Z","dependency_job_id":null,"html_url":"https://github.com/appsynth-org/danger-kotlin-jacoco","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appsynth-org%2Fdanger-kotlin-jacoco","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appsynth-org%2Fdanger-kotlin-jacoco/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appsynth-org%2Fdanger-kotlin-jacoco/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appsynth-org%2Fdanger-kotlin-jacoco/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appsynth-org","download_url":"https://codeload.github.com/appsynth-org/danger-kotlin-jacoco/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224224797,"owners_count":17276428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["danger","danger-kotlin","jacoco"],"created_at":"2024-08-02T14:00:34.820Z","updated_at":"2026-01-11T17:48:13.880Z","avatar_url":"https://github.com/appsynth-org.png","language":"Kotlin","funding_links":[],"categories":["Plugins"],"sub_categories":["Kotlin (danger-kotlin)"],"readme":"# danger-kotlin JaCoCo plugin\n\n![Maven Central](https://img.shields.io/maven-central/v/net.appsynth.danger/danger-kotlin-jacoco)\n\nPlugin for [danger-kotlin](https://github.com/danger/kotlin) that can parse JaCoCo code coverage reports\nand post results as PR comments.\n\n## Usage\n\nTo use this plugin, first put\n```kotlin\n@file:DependsOn(\"net.appsynth.danger:danger-kotlin-jacoco:X.Y.Z\")\n```\nand\n```kotlin\nregister plugin JaCoCoPlugin\n```\nin your `Dangerfile.df.kts`.\n\nAfter this, you can use `JaCoCoPlugin` class, which provides 2 main methods:\n```kotlin\nJaCoCoPlugin.parse(vararg reportFiles: File)\nJaCoCoPlugin.report(filePaths: List\u003cString\u003e)\n```\n\nAlternatively you can use `jacoco {}` to keep danger file more organized:\n```kotlin\njacoco {\n    parse(File(\"app/build/reports/jacoco/jacoco.xml\"))\n    report(git.modifiedFiles + git.createdFiles)\n}\n```\n\nTo produce coverage summary that would show coverage value changes, you can use\n`JaCoCoPlugin.reference(vararg reportFiles: File)` method.\n\nFor additional control, there are some useful configuration options you can set:\n```kotlin\njacoco {\n    // exclude files matching any of listed regular expressions\n    // if not set, the list is empty\n    excludePatterns = listOf(\n        Regex(\".*Test\\\\.(kt|java)\")\n    )\n\n    // to reduce the size of the summary, there is a limit of 20 reported files\n    // you can override this value with below parameter\n    maxReportedFiles = 10\n\n    // files that don't have any entries in JaCoCo report, are marked as not covered\n    // by default there will be a warning added about this\n    // to turn it off, set as below\n    noCoverageWarning = false\n}\n```\n\n### Snapshot versions\n\nTo use snapshot versions of this plugin, just add repository annotation to your `Dangerfile.df.kts`.\n```kotlin\n@file:Repository(\"https://oss.sonatype.org/content/repositories/snapshots/\")\n```\n\n## Examples\n```kotlin\n@file:DependsOn(\"net.appsynth.danger:danger-kotlin-jacoco:X.Y.Z\")\n\nimport net.appsynth.danger.JaCoCoPlugin\nimport net.appsynth.danger.jacoco\nimport systems.danger.kotlin.*\nimport java.io.File\nimport kotlin.io.walk\n\nregister plugin JaCoCoPlugin\n\ndanger(args) {\n    val changedFiles =  git.modifiedFiles + git.createdFiles\n\n    jacoco {\n        val coverageReports = File(\".\")\n            .walk()\n            .maxDepth(10)\n            .filter { it.name == \"jacoco.xml\" }\n            .toList()\n\n        parse(*coverageReports.toTypedArray())\n        report(changedFiles.filter { it.endsWith(\".kt\") || it.endsWith(\".java\") })\n    }\n}\n```\n\nThis will try to find all jacoco.xml files by traversing directory structure up to 10 levels deep.\nThen it will parse all found reports into internal format. At the end it will post summary for modified\nor added Kotlin/Java source files as PR comment.\n\n```kotlin\n@file:DependsOn(\"net.appsynth.danger:danger-kotlin-jacoco:X.Y.Z\")\n\nimport net.appsynth.danger.JaCoCoPlugin\nimport net.appsynth.danger.jacoco\nimport systems.danger.kotlin.*\nimport java.io.File\nimport kotlin.io.walk\n\nregister plugin JaCoCoPlugin\n\ndanger(args) {\n    val changedFiles =  git.modifiedFiles + git.createdFiles\n\n    jacoco {\n        val coverageReports = File(\".\")\n            .walk()\n            .maxDepth(10)\n            .filter {\n                it.name == \"jacoco.xml\" \u0026\u0026 !it.path.contains(\"ref-report\")\n            }\n            .toList()\n\n        parse(*coverageReports.toTypedArray())\n        reference(File(\"ref-report/jacoco.xml\"))\n        report(changedFiles.filter { it.endsWith(\".kt\") || it.endsWith(\".java\") })\n    }\n}\n```\n\nThis example, is almost same like the previous one, but will display more detailed code coverage summary. It will\nadditionally load reference report to produce information about coverage value difference.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappsynth-org%2Fdanger-kotlin-jacoco","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappsynth-org%2Fdanger-kotlin-jacoco","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappsynth-org%2Fdanger-kotlin-jacoco/lists"}