Skip to content
Open
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
2 changes: 1 addition & 1 deletion detect_secrets/core/audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def print_audit_results(baseline_filename):
baseline,
baseline_filename,
),
indent=2,
indent='\t',
sort_keys=True,
),
)
Expand Down
2 changes: 1 addition & 1 deletion detect_secrets/core/baseline.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def format_baseline_for_output(baseline):

return json.dumps(
baseline,
indent=2,
indent='\t',
sort_keys=True,
separators=(',', ': '),
)
Expand Down
2 changes: 1 addition & 1 deletion detect_secrets/core/report/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def print_json_report(
if fail_on_audited_real:
secrets += audited_real_secrets

print(json.dumps({'stats': stats, 'secrets': secrets}, indent=4))
print(json.dumps({'stats': stats, 'secrets': secrets}, indent='\t'))


def print_table_report(
Expand Down
2 changes: 1 addition & 1 deletion detect_secrets/core/secrets_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ def json(self):
def __str__(self): # pragma: no cover
return json.dumps(
self.json(),
indent=2,
indent='\t',
sort_keys=True,
)

Expand Down
138 changes: 69 additions & 69 deletions tests/core/report/output_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,13 +641,13 @@ def test_print_json_report_no_failed_conditions(
assert (
captured.out
== """{
"stats": {
"reviewed": 3,
"live": 0,
"unaudited": 0,
"audited_real": 0
},
"secrets": []
\t"stats": {
\t\t"reviewed": 3,
\t\t"live": 0,
\t\t"unaudited": 0,
\t\t"audited_real": 0
\t},
\t"secrets": []
}\n"""
)

Expand All @@ -674,32 +674,32 @@ def test_print_json_report_failed_conditions(
assert (
captured.out
== """{
"stats": {
"reviewed": 3,
"live": 1,
"unaudited": 1,
"audited_real": 1
},
"secrets": [
{
"failed_condition": "Live",
"filename": "will_be_mocked",
"line": 90,
"type": "Private key"
},
{
"failed_condition": "Unaudited",
"filename": "will_be_mocked",
"line": 120,
"type": "Hex High Entropy String"
},
{
"failed_condition": "Audited as real",
"filename": "will_be_mocked",
"line": 60,
"type": "Hex High Entropy String"
}
]
\t"stats": {
\t\t"reviewed": 3,
\t\t"live": 1,
\t\t"unaudited": 1,
\t\t"audited_real": 1
\t},
\t"secrets": [
\t\t{
\t\t\t"failed_condition": "Live",
\t\t\t"filename": "will_be_mocked",
\t\t\t"line": 90,
\t\t\t"type": "Private key"
\t\t},
\t\t{
\t\t\t"failed_condition": "Unaudited",
\t\t\t"filename": "will_be_mocked",
\t\t\t"line": 120,
\t\t\t"type": "Hex High Entropy String"
\t\t},
\t\t{
\t\t\t"failed_condition": "Audited as real",
\t\t\t"filename": "will_be_mocked",
\t\t\t"line": 60,
\t\t\t"type": "Hex High Entropy String"
\t\t}
\t]
}\n"""
)

Expand All @@ -722,18 +722,18 @@ def test_print_json_report_only_live(
assert (
captured.out
== """{
"stats": {
"reviewed": 3,
"live": 1
},
"secrets": [
{
"failed_condition": "Live",
"filename": "will_be_mocked",
"line": 90,
"type": "Private key"
}
]
\t"stats": {
\t\t"reviewed": 3,
\t\t"live": 1
\t},
\t"secrets": [
\t\t{
\t\t\t"failed_condition": "Live",
\t\t\t"filename": "will_be_mocked",
\t\t\t"line": 90,
\t\t\t"type": "Private key"
\t\t}
\t]
}\n"""
)

Expand All @@ -756,18 +756,18 @@ def test_print_json_report_only_unaudited(
assert (
captured.out
== """{
"stats": {
"reviewed": 3,
"unaudited": 1
},
"secrets": [
{
"failed_condition": "Unaudited",
"filename": "will_be_mocked",
"line": 120,
"type": "Hex High Entropy String"
}
]
\t"stats": {
\t\t"reviewed": 3,
\t\t"unaudited": 1
\t},
\t"secrets": [
\t\t{
\t\t\t"failed_condition": "Unaudited",
\t\t\t"filename": "will_be_mocked",
\t\t\t"line": 120,
\t\t\t"type": "Hex High Entropy String"
\t\t}
\t]
}\n"""
)

Expand All @@ -790,18 +790,18 @@ def test_print_json_report_only_audited_true(
assert (
captured.out
== """{
"stats": {
"reviewed": 3,
"audited_real": 1
},
"secrets": [
{
"failed_condition": "Audited as real",
"filename": "will_be_mocked",
"line": 60,
"type": "Hex High Entropy String"
}
]
\t"stats": {
\t\t"reviewed": 3,
\t\t"audited_real": 1
\t},
\t"secrets": [
\t\t{
\t\t\t"failed_condition": "Audited as real",
\t\t\t"filename": "will_be_mocked",
\t\t\t"line": 60,
\t\t\t"type": "Hex High Entropy String"
\t\t}
\t]
}\n"""
)

Expand Down
4 changes: 2 additions & 2 deletions tests/pre_commit_hook_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def _create_old_baseline(has_result=True, use_private_key_scan=True):
baseline['exclude_regex'] = ''
return json.dumps(
baseline,
indent=2,
indent='\t',
sort_keys=True,
)

Expand All @@ -359,7 +359,7 @@ def _create_baseline(has_result=True, use_private_key_scan=True, audited=True, v
}
return json.dumps(
baseline,
indent=2,
indent='\t',
sort_keys=True,
)

Expand Down