Feature request: output diff
- Dominant language
- Go
- Stars
- 403
- Forks
- 36
- Avg merge
- 4h 24m
- Merged PRs (30d)
- 1
Description
The current json output for `--mode lint` is not human-readable. It would be great to be able to print a diff instead of json.
It can be a new `--diff` flag, or `--format json/diff`, or `--mode diff`.
For example, instead of
```json
[
{
"path": "separator.in",
"lines": {
"start": 4,
"end": 6
},
"message": "These lines are out of order.",
"fixes": [
{
"replacements": [
{
"lines": {
"start": 4,
"end": 6
},
"new_content": " \"Bar\",\n \"Baz\",\n \"Foo\"\n"
}
]
}
]
},
{
"path": "separator.in",
"lines": {
"start": 12,
"end": 16
},
"message": "These lines are out of order.",
"fixes": [
{
"replacements": [
{
"lines": {
"start": 12,
"end": 16
},
"new_content": "// Sticky comment\n\"Bar\",\n\"Baz\",\n\"Foo\"\n// Trailing comments\n"
}
]
}
]
}
]
```
I'd like to see
```diff
--- goldens/separator.in
+++ goldens/separator.in
@@ -1,17 +1,17 @@
Comma separator:
static class Foo {
// keep-sorted-test start
- "Foo",
+ "Bar",
- "Bar",
+ "Baz",
- "Baz"
+ "Foo"
// keep-sorted-test end
}
Comma separator with comments:
-// keep-sorted-test start sticky_comments=yes
-"Foo",
+// keep-sorted-test start sticky_comments=yes
// Sticky comment
"Bar",
-"Baz"
+"Baz",
+"Foo"
// Trailing comments
// keep-sorted-test end
```
Contributor guide
Assessment
This issue has not been assessed yet.