Repository navigation
Add Swift Package Manager scanner - #31
Conversation
Ports the dependency resolution logic from the retired ts-spm plugin (https://github.com/TrustSource/ts-spm) into ts-scan's own Scanner interface. Detects Package.swift and parses the JSON tree produced by `swift package show-dependencies --format json`.
The branch predates "Return an iterable from scanner implementations", so scan() still returned an optional single scan, which makes _execute_scans fail with "'DependencyScan' object is not iterable". Returns a list of scans instead, and an empty list when the swift executable produces no output. The unit tests called scan() directly and therefore did not catch this, so they now assert on the returned sequence. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The list of supported ecosystems in the description had fallen behind and named only a fraction of the available scanners. Names all of them, including the ones added in parallel (Composer, CocoaPods, Swift Package Manager), and adds a table stating for each ecosystem how a project is detected, where the resolved graph comes from and which executable is required. The distinction matters in CI: scanners reading an already resolved lockfile (CocoaPods, Composer and Cargo with a committed lockfile, VB6) need neither a toolchain nor network access. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
31216f0 to
2bf7364
Compare
|
Rebased onto current Conflicts resolved: scanner registry in The rebase surfaced a real defect. This branch predates Return an iterable from scanner implementations, so README (as the last of the three PRs). Commit Therefore merge this one last: #38 → #32 → #31. The README and option list in this PR already describe Full suite green (43 passed). 🤖 Generated with Claude Code |
Summary
Scannerinterface, replacing the need for a separate pluginPackage.swiftand parses the JSON tree produced byswift package show-dependencies --format jsoninto ts-scan'sDependency/DependencyScanmodel, using theswiftpurl type as key/purl prefixSwiftScanneralongside the other package-manager scanners;--swift:ignore,--swift:executableand--swift:forwardbecome available like for the other PM-backed scannersDependencies added
None — uses only the
swiftexecutable already required by Swift Package Manager projects.Test plan
pytest tests/test_swift.py— accepts()/scan() unit tests with a mockedswift package show-dependenciesJSON tree (including diamond-dependency de-duplication)pytest tests/— full existing suite still passes