From bc321ad9978348414c3576a06970d1b8325c3cf2 Mon Sep 17 00:00:00 2001 From: Tim Morgan Date: Tue, 19 May 2026 12:58:55 -0700 Subject: [PATCH 1/2] Add Periphery config and CI workflow; remove dead code Adds .periphery.yml and .github/workflows/periphery.yml, and removes unused declarations/imports flagged by Periphery. Public API preserved for libraries; Codable/@objc/reflection/protocol-witness symbols retained. All tests pass with no regressions. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/periphery.yml | 14 ++++++++++ .periphery.yml | 1 + Sources/SwiftCIFP/CIFP.swift | 3 --- Sources/SwiftCIFP/Parser/CIFPByteParser.swift | 14 ---------- Sources/SwiftCIFP/Types/BearingRange.swift | 12 --------- .../SwiftCIFP/Types/ByteInitializable.swift | 13 ---------- .../SwiftCIFP/Types/Common/RecordType.swift | 26 ------------------- 7 files changed, 15 insertions(+), 68 deletions(-) create mode 100644 .github/workflows/periphery.yml create mode 100644 .periphery.yml diff --git a/.github/workflows/periphery.yml b/.github/workflows/periphery.yml new file mode 100644 index 0000000..48ab9c1 --- /dev/null +++ b/.github/workflows/periphery.yml @@ -0,0 +1,14 @@ +name: Periphery +on: + push: + branches: [main] + pull_request: +jobs: + periphery: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - name: Install Periphery + run: brew install peripheryapp/periphery/periphery + - name: Run Periphery + run: periphery scan diff --git a/.periphery.yml b/.periphery.yml new file mode 100644 index 0000000..85b884a --- /dev/null +++ b/.periphery.yml @@ -0,0 +1 @@ +retain_public: true diff --git a/Sources/SwiftCIFP/CIFP.swift b/Sources/SwiftCIFP/CIFP.swift index a0b0aba..b9ae127 100644 --- a/Sources/SwiftCIFP/CIFP.swift +++ b/Sources/SwiftCIFP/CIFP.swift @@ -30,9 +30,6 @@ import Foundation /// use ``linked()`` to create a ``CIFPData`` actor. public struct CIFP: Sendable, Codable { - /// Estimated number of records for pre-allocation. - private static let estimatedRecordCount = 400_000 - /// The file header information. public let header: Header diff --git a/Sources/SwiftCIFP/Parser/CIFPByteParser.swift b/Sources/SwiftCIFP/Parser/CIFPByteParser.swift index 1d2c15a..0368b21 100644 --- a/Sources/SwiftCIFP/Parser/CIFPByteParser.swift +++ b/Sources/SwiftCIFP/Parser/CIFPByteParser.swift @@ -117,20 +117,6 @@ struct ApproachContinuationRecord: Sendable { /// Parser for CIFP fixed-width records. struct CIFPByteParser: Sendable { - /// Standard CIFP record length. - static let recordLength = 132 - - /// Common field positions (0-indexed). - private static let fields = ( - recordType: 0..<1, - customerArea: 1..<4, - sectionCode: 4..<6, - airportIdent: 6..<10, - icaoRegion: 10..<12, - fileRecordNumber: 123..<128, - cycleDate: 128..<132 - ) - /// Parse a single record line. static func parseRecord( _ bytes: ArraySlice, diff --git a/Sources/SwiftCIFP/Types/BearingRange.swift b/Sources/SwiftCIFP/Types/BearingRange.swift index dddf5d7..55c9f8c 100644 --- a/Sources/SwiftCIFP/Types/BearingRange.swift +++ b/Sources/SwiftCIFP/Types/BearingRange.swift @@ -141,18 +141,6 @@ extension BearingRange { public static var fullCircle: BearingRange { BearingRange(from: 0, to: 360) } - - /// Creates a bearing range from a standard Range. - init(_ range: Range) { - self.init(from: range.lowerBound, to: range.upperBound) - } - - /// Creates a bearing range from a ClosedRange. - /// - /// Note: The upper bound is treated as exclusive for consistency. - init(_ range: ClosedRange) { - self.init(from: range.lowerBound, to: range.upperBound) - } } // MARK: - Measurement Support diff --git a/Sources/SwiftCIFP/Types/ByteInitializable.swift b/Sources/SwiftCIFP/Types/ByteInitializable.swift index e101258..19bf24e 100644 --- a/Sources/SwiftCIFP/Types/ByteInitializable.swift +++ b/Sources/SwiftCIFP/Types/ByteInitializable.swift @@ -11,16 +11,3 @@ extension ByteInitializable { self.init(rawValue: Character(UnicodeScalar(byte))) } } - -/// Protocol for String-based enums that can be initialized from ASCII bytes. -protocol StringByteInitializable: RawRepresentable where RawValue == String { - init?(bytes: some RandomAccessCollection) -} - -extension StringByteInitializable { - /// Initialize from ASCII bytes. - init?(bytes: some RandomAccessCollection) { - guard let string = String(bytes: Array(bytes), encoding: .utf8) else { return nil } - self.init(rawValue: string.trimmingCharacters(in: .whitespaces)) - } -} diff --git a/Sources/SwiftCIFP/Types/Common/RecordType.swift b/Sources/SwiftCIFP/Types/Common/RecordType.swift index f083d90..b41e599 100644 --- a/Sources/SwiftCIFP/Types/Common/RecordType.swift +++ b/Sources/SwiftCIFP/Types/Common/RecordType.swift @@ -11,29 +11,3 @@ enum RecordType: Character, Sendable, Codable, CaseIterable, ByteInitializable { /// Tailored record. case tailored = "T" } - -/// Customer/area code (positions 2-4). -enum CustomerAreaCode: String, Sendable, Codable, CaseIterable { - /// United States. - case usa = "USA" - - /// Canada. - case canada = "CAN" - - /// Pacific. - case pacific = "PAC" - - /// Continuation record (blank). - case continuation = " " - - /// Initialize from bytes, handling the "S " pattern for continuation records. - init?(bytes: T) where T.Element == UInt8, T.Index == Int { - let str = bytes.toString() - if str.isEmpty { - self = .continuation - } else { - guard let code = Self(rawValue: str) else { return nil } - self = code - } - } -} From 701175ffdce3ad6e7d0a84351acb350f1b45ac17 Mon Sep 17 00:00:00 2001 From: Tim Morgan Date: Tue, 19 May 2026 14:50:54 -0700 Subject: [PATCH 2/2] Fix Periphery CI: set up matching Swift/Xcode toolchain; use homebrew-core periphery formula Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/periphery.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/periphery.yml b/.github/workflows/periphery.yml index 48ab9c1..75491e5 100644 --- a/.github/workflows/periphery.yml +++ b/.github/workflows/periphery.yml @@ -1,14 +1,20 @@ name: Periphery + on: push: branches: [main] pull_request: + jobs: periphery: - runs-on: macos-latest + name: Run Periphery + runs-on: macos-26 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 + - uses: SwiftyLab/setup-swift@latest + with: + swift-version: "6.2" - name: Install Periphery - run: brew install peripheryapp/periphery/periphery + run: brew install periphery - name: Run Periphery run: periphery scan