From 56c63b66d69a729c274286b973b900193590cd48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Art=C3=ABm=20Tsvetkov?= Date: Fri, 16 Sep 2022 23:30:02 +0200 Subject: [PATCH] Fix line numbers in jproperties (#61) --- tests/unit/core/test_utils.py | 8 +++++++- whispers/__version__.py | 2 +- whispers/plugins/jproperties.py | 1 - 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/unit/core/test_utils.py b/tests/unit/core/test_utils.py index 28d97cd..bcf6c83 100644 --- a/tests/unit/core/test_utils.py +++ b/tests/unit/core/test_utils.py @@ -94,6 +94,7 @@ def test_similar_strings(str1, str2, expected): ("apikeys.yml", "apikey", "YXNkZmZmZmZm_HARDcoded", 11), ("apikeys.yml", "GITHUBKEY", "YXNkZmZmZmZm_HARDcoded", 19), ("pip.conf", "username", "hardcoded1", 7), + ("java.properties", "sonar.jdbc.password", "hardcoded02", 10), ], ) def test_find_line_number_single(src, key, value, expected): @@ -102,7 +103,12 @@ def test_find_line_number_single(src, key, value, expected): @pytest.mark.parametrize( - ("src", "linenumbers"), [("hardcoded.yml", [12, 14, 15, 16, 19]), ("privatekeys.yml", [5, 7, 11, 12, 13, 14])], + ("src", "linenumbers"), + [ + ("hardcoded.yml", [12, 14, 15, 16, 19]), + ("privatekeys.yml", [5, 7, 11, 12, 13, 14]), + ("java.properties", [9, 10, 11]), + ], ) def test_find_line_number_all(src, linenumbers): args = parse_args([fixture_path(src)]) diff --git a/whispers/__version__.py b/whispers/__version__.py index bade86a..e83e9cb 100644 --- a/whispers/__version__.py +++ b/whispers/__version__.py @@ -1,4 +1,4 @@ -VERSION = (2, 1, 4) +VERSION = (2, 1, 5) __version__ = ".".join(map(str, VERSION)) diff --git a/whispers/plugins/jproperties.py b/whispers/plugins/jproperties.py index 35131c9..49f0f43 100644 --- a/whispers/plugins/jproperties.py +++ b/whispers/plugins/jproperties.py @@ -11,5 +11,4 @@ def pairs(self, filepath: Path) -> Iterator[KeyValuePair]: props = Properties() props.load(filepath.read_text(), "utf-8") for key, value in props.properties.items(): - key = key.replace(".", "_") yield KeyValuePair(key, value, [key])