Skip to content

Commit a679e2a

Browse files
committed
Merge remote-tracking branch 'origin/master' into dakranj_add_ci
2 parents 00816f9 + 75a5844 commit a679e2a

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

Diff for: detect_secrets/core/secrets_collection.py

+16-4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
from . import scan
1313
from .potential_secret import PotentialSecret
14+
from detect_secrets.settings import configure_settings_from_baseline
15+
from detect_secrets.settings import get_settings
1416

1517

1618
class PatchedFile:
@@ -55,7 +57,13 @@ def scan_files(self, *filenames: str, num_processors: Optional[int] = None) -> N
5557
if not num_processors:
5658
num_processors = mp.cpu_count()
5759

58-
with mp.Pool(processes=num_processors) as p:
60+
child_process_settings = get_settings().json()
61+
62+
with mp.Pool(
63+
processes=num_processors,
64+
initializer=configure_settings_from_baseline,
65+
initargs=(child_process_settings,),
66+
) as p:
5967
for secrets in p.imap_unordered(
6068
_scan_file_and_serialize,
6169
[os.path.join(self.root, filename) for filename in filenames],
@@ -241,8 +249,12 @@ def __eq__(self, other: Any, strict: bool = False) -> bool:
241249
return False
242250

243251
for filename in self.files:
244-
self_mapping = {secret.secret_hash: secret for secret in self[filename]}
245-
other_mapping = {secret.secret_hash: secret for secret in other[filename]}
252+
self_mapping = {
253+
(secret.secret_hash, secret.type): secret for secret in self[filename]
254+
}
255+
other_mapping = {
256+
(secret.secret_hash, secret.type): secret for secret in other[filename]
257+
}
246258

247259
# Since PotentialSecret is hashable, we compare their identities through this.
248260
if set(self_mapping.values()) != set(other_mapping.values()):
@@ -252,7 +264,7 @@ def __eq__(self, other: Any, strict: bool = False) -> bool:
252264
continue
253265

254266
for secretA in self_mapping.values():
255-
secretB = other_mapping[secretA.secret_hash]
267+
secretB = other_mapping[(secretA.secret_hash, secretA.type)]
256268

257269
valuesA = vars(secretA)
258270
valuesA.pop('secret_value')

0 commit comments

Comments
 (0)