Open
Description
I struggled with the raw diffs at first, even writing my own parsers, before I discovered a better way. I thought I'd share a good library that works perfectly with danger-kotlin
: https://github.com/thombergs/diffparser
Usage example:
@file:Repository("https://jcenter.bintray.com")
@file:DependsOn("io.reflectoring.diffparser:diffparser:1.4")
danger(args) {
val diff = UnifiedDiffParser().parse(git.diff!!.byteInputStream())
}
From that object, it's trivial to get changed files, lines added, removed, the different chunks etc. It's a small library, so autocompletion should be all the docs you need, really.
Metadata
Metadata
Assignees
Labels
No labels