Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
babenek committed Aug 30, 2024
1 parent 2b3286c commit f8ed3dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .ci/benchmark.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
META MD5 5e76eb08412164f08a93204828f5daee
DATA MD5 732282f70585777b9f81e0faefe8832b
DATA MD5 f704d35540464f5515625114b664f79e
DATA: 16345157 interested lines. MARKUP: 62779 items
FileType FileNumber ValidLines Positives Negatives Templates
--------------- ------------ ------------ ----------- ----------- -----------
Expand Down
10 changes: 5 additions & 5 deletions credsweeper/credentials/line_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,16 @@ def clean_bash_parameters(self) -> None:

def clean_toml_parameters(self) -> None:
"""Parenthesis, curly and squared brackets may be caught in TOML format and bash. Simple clearing"""
dirty=self.value and self.value[-1] in ['}',']',')']
line_before_value=self.line[: self.value_start]
dirty = self.value and self.value[-1] in ['}', ']', ')']
line_before_value = self.line[:self.value_start]
while dirty:
dirty=False
for left,right in [('{','}'), ('[',']'), ('(',')')]:
dirty = False
for left, right in [('{', '}'), ('[', ']'), ('(', ')')]:
if self.value.endswith(right) and left not in self.value \
and line_before_value.count(left) > line_before_value.count(right):
# full match does not reasonable to implement due open character may be in other line
self.value = self.value[:-1]
dirty=True
dirty = True

def sanitize_variable(self) -> None:
"""Remove trailing spaces, dashes and quotations around the variable. Correct position."""
Expand Down

0 comments on commit f8ed3dc

Please sign in to comment.