Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[baseline output] Add sort_keys=True to json.dumps #25

Merged
merged 2 commits into from
Jun 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion detect_secrets/core/secrets_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,11 @@ def json(self):
return output

def __str__(self): # pragma: no cover
return json.dumps(self.json(), indent=2)
return json.dumps(
self.json(),
indent=2,
sort_keys=True
)

def __getitem__(self, key): # pragma: no cover
return self.data[key]
Expand Down
1 change: 1 addition & 0 deletions detect_secrets/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def main(argv=None):
args.scan
).format_for_baseline_output(),
indent=2,
sort_keys=True
)
)

Expand Down
1 change: 1 addition & 0 deletions detect_secrets/pre_commit_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def main(argv=None):
json.dumps(
baseline_collection.format_for_baseline_output(),
indent=2,
sort_keys=True
)
)

Expand Down
6 changes: 5 additions & 1 deletion tests/pre_commit_hook_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,8 @@ def _create_baseline():
},
}

return json.dumps(baseline, indent=2)
return json.dumps(
baseline,
indent=2,
sort_keys=True
)