Skip to content

Commit

Permalink
Version up to 1.4.5 (#243)
Browse files Browse the repository at this point in the history
* Version up to 1.4.5 and template fix

* Update whatthepath requirement version to avoid huge diffs check.

* Added test for huge patches parsing
  • Loading branch information
babenek committed Nov 15, 2022
1 parent d2e07b8 commit d7e44c7
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/pull-request-template.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Description

Please include a summary of the change and which is is fixed.
Please include a summary of the change and which is fixed.

- Add A
- Fix B
Expand Down
2 changes: 1 addition & 1 deletion credsweeper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@

CREDSWEEPER_DIR = Path(__file__).resolve().parent

__version__ = "1.4.4"
__version__ = "1.4.5"
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ PyYAML~=6.0
regex~=2022.8.17
requests~=2.28.0
typing_extensions~=4.2.0
whatthepatch~=1.0.2
whatthepatch~=1.0.3

# ML requirements
numpy<=1.23.0
Expand Down
26 changes: 26 additions & 0 deletions tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,32 @@ def test_it_works_p(self) -> None:

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

def test_huge_diff_p(self) -> None:
# verifies issue when huge patch is parsed very slow
# https://github.com/Samsung/CredSweeper/issues/242
text = """diff --git a/huge.file b/huge.file
index 0000000..1111111 100644
--- a/huge.file
+++ a/huge.file
@@ -3,13 +3,1000007 @@
00000000
11111111
22222222
-33333333
-44444444
+55555555
+66666666
"""
for n in range(0, 1000000):
text += "+" + hex(n) + "\n"
with tempfile.TemporaryDirectory() as tmp_dir:
target_path = os.path.join(tmp_dir, f"{__name__}.diff")
start_time = time.time()
_stdout, _stderr = self._m_credsweeper(["--path", target_path, "--ml_threshold", "0", "--log", "silence"])
self.assertGreater(100, time.time() - start_time)

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

def test_it_works_without_ml_p(self) -> None:
target_path = str(SAMPLES_DIR / "password")
_stdout, _stderr = self._m_credsweeper(["--path", target_path, "--ml_threshold", "0", "--log", "silence"])
Expand Down

0 comments on commit d7e44c7

Please sign in to comment.