Repository navigation
fix: match Swift frameworks by repository name in package URLs - #598
Open
17302513901yh-lang wants to merge 1 commit into
Open
17302513901yh-lang wants to merge 1 commit into
17302513901yh-lang wants to merge 1 commit into
Conversation
Framework detection lowercases the last path segment of the package URL and looks it up in KNOWN_SWIFT_FRAMEWORKS, but two entries were spelled so they could never match: 'snapshotTesting' had an uppercase letter (and the repository is swift-snapshot-testing), and 'swiftlog' is not the repository name swift-log. Projects depending on SwiftSnapshotTesting or SwiftLog therefore never reported those frameworks. Key the map on the lowercased repository names used in package URLs, and add tests: one asserting every key is lowercase, and one scanning a Package.swift that depends on swift-snapshot-testing and swift-log. Fixes vibgrate#585 Signed-off-by: 17302513901yh-lang <17302513901yh@gmail.com>
Contributor
|
Automated review: passed ✅ Thanks @17302513901yh-lang, nice catch! Those two keys could never match the lowercased repository name, so SnapshotTesting and SwiftLog were silently missing from detected frameworks. The fix is small and well targeted, and the new tests guard the invariant nicely. What we checked:
A maintainer will take it from here. Thanks again for contributing to Vibgrate! |
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.
What was wrong
KNOWN_SWIFT_FRAMEWORKSinsrc/core-open/scanners/swift-scanner.tsis lookedup with the dependency name lowercased (
dep.name.toLowerCase(), wheredep.nameis the last path segment of the package URL). Two entries werespelled so they could never match:
'snapshotTesting'— has an uppercase letter, and the repository isswift-snapshot-testing, notsnapshotTesting.'swiftlog'— the repository isswift-log.So a
Package.swiftdepending onhttps://github.com/pointfreeco/swift-snapshot-testing.gitorhttps://github.com/apple/swift-log.gitnever reportedSnapshotTestingorSwiftLogunder detected frameworks.What changed
src/core-open/scanners/swift-scanner.ts'snapshotTesting'→'swift-snapshot-testing''swiftlog'→'swift-log'URLs, and exported the map so a test can guard that invariant
(
alamofire,apollo-ios,sqlite.swift,grdb.swift,cocoalumberjack,…) and are already correct
Tests
New
src/core-open/scanners/swift-scanner.test.ts(2 cases, both passing):KNOWN_SWIFT_FRAMEWORKSequals its lowercase form, so acamelCase or otherwise mis-cased key fails the build
Package.swiftdepending onswift-snapshot-testingandswift-logreportsSnapshotTestingandSwiftLogas frameworkstsc --noEmitand eslint are clean for the touched files.Fixes #585