Skip to content

Commit da5cd60

Browse files
RISCfutureclaude
andcommitted
Remove dead code flagged by Periphery
Prune unused symbols the scan flagged and enforce `periphery scan --strict` in CI. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 455f6a7 commit da5cd60

17 files changed

Lines changed: 16 additions & 150 deletions

File tree

.github/workflows/periphery.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ jobs:
1515
- name: Install Periphery
1616
run: brew install peripheryapp/periphery/periphery
1717
- name: Run Periphery
18-
run: periphery scan
18+
run: periphery scan --strict

.periphery.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
retain_public: true
2+
retain_assign_only_properties: true
3+
external_test_case_classes:
4+
- QuickSpec
5+
- AsyncSpec

Sources/SwiftNASR/Downloaders/Downloader.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ extension Downloader {
9494
}
9595
}
9696

97+
// periphery:ignore - default protocol implementation; always provided by conformers
9798
func load(withProgress progressHandler: @Sendable (Progress) -> Void = { _ in }) throws
9899
-> Distribution
99100
{

Sources/SwiftNASR/Models/Records/ARTCC.swift

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,6 @@ public struct ARTCC: ParentRecord {
9898
/// Fields that per-field remarks can be associated with.
9999
public enum Field: String, RemarkField {
100100
case alternateName, stateCode, location
101-
102-
static let fieldOrder: [Self?] = [
103-
nil, nil, nil, nil, .alternateName, nil, nil, .stateCode,
104-
.stateCode, .location, .location, .location, .location, nil, nil
105-
]
106101
}
107102

108103
// MARK: - Classes
@@ -144,15 +139,6 @@ public struct ARTCC: ParentRecord {
144139
/// Fields that per-field remarks can be associated with.
145140
public enum Field: String, RemarkField {
146141
case altitude, associatedAirportCode
147-
148-
static let fieldOrder: [Self?] = [
149-
nil, nil, nil, nil, nil, .altitude, nil, nil,
150-
.associatedAirportCode, .associatedAirportCode,
151-
.associatedAirportCode, .associatedAirportCode,
152-
.associatedAirportCode, .associatedAirportCode,
153-
.associatedAirportCode, .associatedAirportCode,
154-
.associatedAirportCode
155-
]
156142
}
157143

158144
enum CodingKeys: String, CodingKey {

Sources/SwiftNASR/Models/Records/Airway.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ public struct Airway: ParentRecord {
2626
/// General remarks about the entire airway.
2727
public internal(set) var remarks = [String]()
2828

29-
weak var data: NASRData?
30-
3129
public var id: String { "\(designation)\(type.rawValue)" }
3230

3331
// MARK: - Nested Types

Sources/SwiftNASR/NASRData.swift

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,7 @@ public actor NASRData {
112112
}
113113

114114
/// Airways loaded by SwiftNASR.
115-
public var airways: [Airway]? {
116-
didSet {
117-
guard airways != nil else { return }
118-
for airwayIndex in 0..<airways!.count {
119-
airways![airwayIndex].data = self
120-
}
121-
}
122-
}
115+
public var airways: [Airway]?
123116

124117
/// ILS facilities loaded by SwiftNASR.
125118
public var ILSFacilities: [ILS]? {
@@ -586,15 +579,6 @@ extension WeatherStation {
586579
}
587580
}
588581

589-
extension Airway {
590-
591-
/// Resolves the ARTCC for a segment by its ID.
592-
func resolveARTCC(_ artccID: String?) async -> ARTCC? {
593-
guard let artccID else { return nil }
594-
return await data?.ARTCCs?.first { $0.code == artccID }
595-
}
596-
}
597-
598582
extension ILS {
599583

600584
/// The airport where this ILS is located.

Sources/SwiftNASR/Parsers/ByteParsing/ASCII.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
// periphery:ignore:all
12
/// Named ASCII byte constants for use in byte-level parsing.
23
///
34
/// Using named constants instead of inline literals improves readability and reduces errors.
5+
/// This is a deliberately complete reference table covering the printable ASCII range, so
6+
/// individual unused entries are retained for coherence.
47
@usableFromInline
58
enum ASCII {
69
// Control characters

Sources/SwiftNASR/Parsers/ByteParsing/ByteTransformer.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ struct ByteTransformer {
1717
self.fields = fields
1818
}
1919

20-
/// Parses a frequency from bytes to kHz.
21-
static func parseFrequency(_ bytes: ByteSlice) -> UInt? {
22-
bytes.parseFrequencyKHz()
23-
}
24-
2520
/// Parses a frequency string to kHz.
2621
static func parseFrequency(_ string: String) -> UInt? {
2722
Array(string.utf8)[...].parseFrequencyKHz()

Sources/SwiftNASR/Parsers/CSV/CSVTransformer.swift

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -68,51 +68,6 @@ struct TransformedRow {
6868
struct CSVTransformer {
6969
// MARK: - Type Properties
7070

71-
static var yearOnly: DateFormatter {
72-
let df = DateFormatter()
73-
df.dateFormat = "yyyy"
74-
df.timeZone = zulu
75-
return df
76-
}
77-
static var monthYear: DateFormatter {
78-
let df = DateFormatter()
79-
df.dateFormat = "MM/yyyy"
80-
df.timeZone = zulu
81-
return df
82-
}
83-
static var monthDayYear: DateFormatter {
84-
let df = DateFormatter()
85-
df.dateFormat = "MMddyyyy"
86-
df.timeZone = zulu
87-
return df
88-
}
89-
static var monthDayYearSlash: DateFormatter {
90-
let df = DateFormatter()
91-
df.dateFormat = "MM/dd/yyyy"
92-
df.timeZone = zulu
93-
return df
94-
}
95-
// CSV date formats (FAA CSV uses yyyy/MM/dd and yyyy/MM)
96-
static var yearMonthDaySlash: DateFormatter {
97-
let df = DateFormatter()
98-
df.dateFormat = "yyyy/MM/dd"
99-
df.timeZone = zulu
100-
return df
101-
}
102-
static var yearMonthSlash: DateFormatter {
103-
let df = DateFormatter()
104-
df.dateFormat = "yyyy/MM"
105-
df.timeZone = zulu
106-
return df
107-
}
108-
static var dayMonthYear: DateFormatter {
109-
let df = DateFormatter()
110-
df.dateFormat = "dd MMM yyyy"
111-
df.locale = Locale(identifier: "en_US_POSIX")
112-
df.timeZone = zulu
113-
return df
114-
}
115-
11671
private static let ddmmssParser = DDMMSSParser()
11772

11873
// MARK: - Instance Properties

Sources/SwiftNASR/Parsers/FixedWidthParser/FixedWidthNoRecordIDParser.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ extension FixedWidthNoRecordIDParser {
1616
try parseValues(slices)
1717
}
1818

19+
// periphery:ignore - abstract requirement; subclasses must provide an implementation
1920
@available(*, unavailable)
2021
func finish(data _: NASRData) {
2122
fatalError("must be implemented by subclasses")

0 commit comments

Comments
 (0)