Skip to content

Commit b080ad9

Browse files
committed
Avoid rendering empty stats object when running diffs
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
1 parent 442daf8 commit b080ad9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pkg/render/json.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (r JSON) Full(_ context.Context, c *malcontent.Config, rep *malcontent.Repo
5252
return true
5353
})
5454

55-
if c != nil && c.Stats {
55+
if c != nil && c.Stats && rep.Diff == nil {
5656
jr.Stats = serializedStats(c, rep)
5757
}
5858

pkg/render/yaml.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (r YAML) Full(_ context.Context, c *malcontent.Config, rep *malcontent.Repo
5252
return true
5353
})
5454

55-
if c != nil && c.Stats {
55+
if c != nil && c.Stats && rep.Diff == nil {
5656
yr.Stats = serializedStats(c, rep)
5757
}
5858

0 commit comments

Comments
 (0)