Skip to content

Commit

Permalink
Fix line numbers in jproperties (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
adeptex authored Sep 16, 2022
1 parent 383c88a commit 56c63b6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
8 changes: 7 additions & 1 deletion tests/unit/core/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)])
Expand Down
2 changes: 1 addition & 1 deletion whispers/__version__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = (2, 1, 4)
VERSION = (2, 1, 5)

__version__ = ".".join(map(str, VERSION))

Expand Down
1 change: 0 additions & 1 deletion whispers/plugins/jproperties.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])

0 comments on commit 56c63b6

Please sign in to comment.