0

Can you suggest a library which would run on the JVM (i. e. written in Java or Kotlin or any other JVM language), capable of converting a unified diff:

--- old.txt     2022-11-28 11:53:00.850238400 +0300
+++ new.txt     2022-11-28 11:53:16.600238400 +0300
@@ -1,5 +1,5 @@
 Header
 
-Old content
+New content
 
 Footer

into a replacement object in the SARIF format?

In other words, given the above example, I want to achieve something like this:

"replacements": [
  {
    "deletedRegion": {
      "startLine": 3,
      "startColumn": 1,
      "endColumn": 11
    },
    "insertedContent": {
      "text": "New content"
    }
  }
]
Bass
  • 4,977
  • 2
  • 36
  • 82

0 Answers0