diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bfccb36ac..4515b541a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest] - python: ['3.6', '3.7', '3.8', '3.9'] + python: ['3.7', '3.8', '3.9'] steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 diff --git a/detect_secrets/core/secrets_collection.py b/detect_secrets/core/secrets_collection.py index 05f770a73..d3fc4dd56 100644 --- a/detect_secrets/core/secrets_collection.py +++ b/detect_secrets/core/secrets_collection.py @@ -11,6 +11,8 @@ from . import scan from .potential_secret import PotentialSecret +from detect_secrets.settings import configure_settings_from_baseline +from detect_secrets.settings import get_settings class PatchedFile: @@ -55,7 +57,13 @@ def scan_files(self, *filenames: str, num_processors: Optional[int] = None) -> N if not num_processors: num_processors = mp.cpu_count() - with mp.Pool(processes=num_processors) as p: + child_process_settings = get_settings().json() + + with mp.Pool( + processes=num_processors, + initializer=configure_settings_from_baseline, + initargs=(child_process_settings,), + ) as p: for secrets in p.imap_unordered( _scan_file_and_serialize, [os.path.join(self.root, filename) for filename in filenames], @@ -241,8 +249,12 @@ def __eq__(self, other: Any, strict: bool = False) -> bool: return False for filename in self.files: - self_mapping = {secret.secret_hash: secret for secret in self[filename]} - other_mapping = {secret.secret_hash: secret for secret in other[filename]} + self_mapping = { + (secret.secret_hash, secret.type): secret for secret in self[filename] + } + other_mapping = { + (secret.secret_hash, secret.type): secret for secret in other[filename] + } # Since PotentialSecret is hashable, we compare their identities through this. if set(self_mapping.values()) != set(other_mapping.values()): @@ -252,7 +264,7 @@ def __eq__(self, other: Any, strict: bool = False) -> bool: continue for secretA in self_mapping.values(): - secretB = other_mapping[secretA.secret_hash] + secretB = other_mapping[(secretA.secret_hash, secretA.type)] valuesA = vars(secretA) valuesA.pop('secret_value')