class

Analyzer::Swift::SwiftEngine

Inherits FileScanEngine < Analyzer < FileHelper < Reference < Object

Constants

FUNCTION_SIGNATURE_PATTERN = /\bfunc\s+([A-Za-z_]\w*)\s*\(/
LOOKAHEAD_LIMIT = 20

Maximum number of lines to look ahead for function parameters

Class methods

swift_test_path?(relative_path : String) : Bool

Tests/... directory + *Tests.swift filename: the rigid Swift Package Manager / XCTest conventions for test sources. The package-benchmark plugin's Benchmarks/ directory is skipped alike when it sits at the scan base (see package_benchmark_path? for the nested-package case).

Both take the scan-base-relative path (Analyzer#base_relative_path), never the absolute one — SwiftPM's layout is relative to the package, and matching the absolute path made the scan's answer depend on where the package happened to be checked out.

Source
swift_vendor_path?(relative_path : String) : Bool

SwiftPM parks resolved dependency sources under .build/ (and Xcode under .swiftpm/). Scanning them pulls every transitive package's routes into the report — pure noise against the project under test.

Source

Instance methods

extract_function_params(lines : Array(String), code_lines : Array(String), route_index : Int32, endpoint : Endpoint)

Params read inside a route's trailing closure. route_index is the route line itself, so the closure's own { is counted and the scan ends where that closure closes (on the route line for a one-liner). Braces are counted on code_lines (strip_code_lines(lines), built once per file: stripping here per route was O(line) per route).

Source
extract_path_params(route : String, endpoint : Endpoint)

Extract path parameters from the route pattern (e.g., :id, :userID)

Source