From d5f80c0e939927a359c7fea909d77acf58fb4680 Mon Sep 17 00:00:00 2001 From: Mikael Berrin Date: Tue, 2 Aug 2022 16:10:52 +0200 Subject: [PATCH 1/3] Add .NET packages.lock.json to is_lock_file filter --- detect_secrets/filters/heuristic.py | 1 + tests/filters/heuristic_filter_test.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/detect_secrets/filters/heuristic.py b/detect_secrets/filters/heuristic.py index a7b661668..518cb2b06 100644 --- a/detect_secrets/filters/heuristic.py +++ b/detect_secrets/filters/heuristic.py @@ -208,6 +208,7 @@ def is_lock_file(filename: str) -> bool: 'Pipfile.lock', 'poetry.lock', 'Cargo.lock', + 'packages.lock.json' } diff --git a/tests/filters/heuristic_filter_test.py b/tests/filters/heuristic_filter_test.py index 3906a8feb..1962731ae 100644 --- a/tests/filters/heuristic_filter_test.py +++ b/tests/filters/heuristic_filter_test.py @@ -135,8 +135,9 @@ def test_is_indirect_reference(line, result): def test_is_lock_file(): - # Basic test + # Basic tests assert filters.heuristic.is_lock_file('composer.lock') + assert filters.heuristic.is_lock_file('packages.lock.json') # file path assert filters.heuristic.is_lock_file('path/yarn.lock') From 90fbf9ffeb2b9a6b9ed7a7293937ddffa95903ad Mon Sep 17 00:00:00 2001 From: Mikael Berrin Date: Tue, 2 Aug 2022 16:18:39 +0200 Subject: [PATCH 2/3] Add trailing comma --- detect_secrets/filters/heuristic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detect_secrets/filters/heuristic.py b/detect_secrets/filters/heuristic.py index 518cb2b06..c95995d65 100644 --- a/detect_secrets/filters/heuristic.py +++ b/detect_secrets/filters/heuristic.py @@ -208,7 +208,7 @@ def is_lock_file(filename: str) -> bool: 'Pipfile.lock', 'poetry.lock', 'Cargo.lock', - 'packages.lock.json' + 'packages.lock.json', } From b108b2eba9ca0eeac54c931821451bd1cb142a42 Mon Sep 17 00:00:00 2001 From: Mikael Berrin Date: Fri, 5 Aug 2022 12:56:12 +0200 Subject: [PATCH 3/3] Fix "E275 missing whitespace after keyword" --- detect_secrets/plugins/base.py | 2 +- tests/pre_commit_hook_test.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/detect_secrets/plugins/base.py b/detect_secrets/plugins/base.py index 835bc26b8..01d0f6f14 100644 --- a/detect_secrets/plugins/base.py +++ b/detect_secrets/plugins/base.py @@ -57,7 +57,7 @@ def analyze_line( is_verified: bool = False # If the filter is disabled it means --no-verify flag was passed # We won't run verification in that case - if( + if ( 'detect_secrets.filters.common.is_ignored_due_to_verification_policies' in get_settings().filters ): diff --git a/tests/pre_commit_hook_test.py b/tests/pre_commit_hook_test.py index c1d48a290..d2f9ee98d 100644 --- a/tests/pre_commit_hook_test.py +++ b/tests/pre_commit_hook_test.py @@ -113,11 +113,11 @@ def test_console_output_json_formatting(): # Assert formatting data = json.loads(capturedOutput.getvalue()) - assert(data['version']) - assert(data['plugins_used']) - assert(data['filters_used']) - assert(data['results']) - assert(data['generated_at']) + assert (data['version']) + assert (data['plugins_used']) + assert (data['filters_used']) + assert (data['results']) + assert (data['generated_at']) class TestModifiesBaselineFromVersionChange: