Skip to content

Commit

Permalink
write a report regardless if leaks are present (gitleaks#758)
Browse files Browse the repository at this point in the history
  • Loading branch information
zricethezav authored Dec 17, 2021
1 parent 36779df commit 43ec224
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion report/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

func writeJson(findings []Finding, w io.WriteCloser) error {
if len(findings) == 0 {
return nil
findings = []Finding{}
}
encoder := json.NewEncoder(w)
encoder.SetIndent("", " ")
Expand Down
3 changes: 1 addition & 2 deletions report/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ func TestWriteJSON(t *testing.T) {
}},
{

wantEmpty: true,
testReportName: "empty",
expected: filepath.Join(expectPath, "report", "this_should_not_exist.json"),
expected: filepath.Join(expectPath, "report", "empty.json"),
findings: []Finding{}},
}

Expand Down
3 changes: 0 additions & 3 deletions report/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ const (
)

func Write(findings []Finding, cfg config.Config, ext string, reportPath string) error {
if len(findings) == 0 {
return nil
}
file, err := os.Create(reportPath)
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions testdata/expected/report/empty.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]

0 comments on commit 43ec224

Please sign in to comment.