Add CocoaPods scanner - #32
Open
jthDEV wants to merge 1 commit into
Open
Conversation
Parses the resolved dependency graph directly from Podfile.lock (PODS, DEPENDENCIES and SPEC CHECKSUMS sections). No pod executable is required since the lockfile is already fully resolved. Adds PyYAML as an explicit dependency for parsing the lockfile.
| def test_accepts_requires_podfile_lock(tmp_path): | ||
| scanner = CocoaPodsScanner() | ||
|
|
||
| assert not scanner.accepts(tmp_path) |
|
|
||
| (tmp_path / 'Podfile.lock').write_text(PODFILE_LOCK) | ||
|
|
||
| assert scanner.accepts(tmp_path) |
| scanner = CocoaPodsScanner() | ||
| scan = scanner.scan(project) | ||
|
|
||
| assert scan is not None |
| scan = scanner.scan(project) | ||
|
|
||
| assert scan is not None | ||
| assert scan.module == 'MyApp' |
|
|
||
| assert scan is not None | ||
| assert scan.module == 'MyApp' | ||
| assert scan.moduleId == 'cocoapods:MyApp' |
| assert alamofire.key == 'cocoapods:Alamofire' | ||
|
|
||
| sdwebimage = next(d for d in root.dependencies if d.name == 'SDWebImage') | ||
| assert sdwebimage.versions == ['5.15.5'] |
|
|
||
| sdwebimage = next(d for d in root.dependencies if d.name == 'SDWebImage') | ||
| assert sdwebimage.versions == ['5.15.5'] | ||
| assert [d.name for d in sdwebimage.dependencies] == ['SDWebImage/Core'] |
| assert [d.name for d in sdwebimage.dependencies] == ['SDWebImage/Core'] | ||
|
|
||
| core = sdwebimage.dependencies[0] | ||
| assert core.versions == ['5.15.5'] |
|
|
||
| core = sdwebimage.dependencies[0] | ||
| assert core.versions == ['5.15.5'] | ||
| assert core.checksum == '750adf017a716fe6f235d0c8d95406e358be216' |
|
|
||
| scanner = CocoaPodsScanner() | ||
|
|
||
| assert scanner.scan(project) is None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CocoaPodsScannerthat parses the fully resolved dependency graph directly fromPodfile.lock(PODS,DEPENDENCIES,SPEC CHECKSUMSsections) — nopodexecutable invocation needed since the lockfile is already resolvedcocoapodspurl type as key/purl prefix; per-pod checksums fromSPEC CHECKSUMSare attached to eachDependencyCocoaPodsScanneralongside the other package-manager scanners;--cocoapods:ignorebecomes available like for the other PM scannersDependencies added
PyYAML~=6.0— to parse the YAML-formattedPodfile.lock(was already present as a transitive dependency ofspdx-tools, now declared explicitly since ts-scan relies on it directly)Test plan
pytest tests/test_cocoapods.py— accepts()/scan() unit tests against a representativePodfile.lockfixture, including a subspec dependency (SDWebImage/Core) and checksum propagationpytest tests/— full existing suite still passes