Skip to content

Commit de43fe5

Browse files
committed
Fix not identifying all Github token occurrences in a file Issue #858
1 parent 10d13a8 commit de43fe5

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

detect_secrets/plugins/base.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,8 @@ def denylist(self) -> Iterable[Pattern]:
165165

166166
def analyze_string(self, string: str) -> Generator[str, None, None]:
167167
for regex in self.denylist:
168-
for match in regex.findall(string):
169-
if isinstance(match, tuple):
170-
for submatch in filter(bool, match):
171-
# It might make sense to paste break after yielding
172-
yield submatch
173-
else:
174-
yield match
168+
for match in regex.finditer(string):
169+
yield match.group(0) # Returns the entire matched string
175170

176171
@staticmethod
177172
def build_assignment_regex(

0 commit comments

Comments
 (0)