Skip to content

Commit d420bec

Browse files
RISCfutureclaude
andcommitted
Fix curly-quote delimiters and use plain strings on Linux
Fix String(localized:) curly-quote string delimiters to use straight quotes. Use plain string literals in #else blocks since String(localized:) is not available on Linux Foundation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 91cbeb1 commit d420bec

1 file changed

Lines changed: 61 additions & 90 deletions

File tree

Sources/SwiftCIFP/Parser/CIFPError.swift

Lines changed: 61 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -92,67 +92,67 @@ public enum CIFPError: Error, LocalizedError, Sendable {
9292
#if canImport(Darwin)
9393
String(localized: "File encoding was invalid.", bundle: .module)
9494
#else
95-
String(localized: "File encoding was invalid.")
95+
"File encoding was invalid."
9696
#endif
9797
case .invalidFormat:
9898
#if canImport(Darwin)
9999
String(localized: "CIFP data format was invalid.", bundle: .module)
100100
#else
101-
String(localized: "CIFP data format was invalid.")
101+
"CIFP data format was invalid."
102102
#endif
103103
case .parseError:
104104
#if canImport(Darwin)
105105
String(localized: "CIFP data could not be parsed.", bundle: .module)
106106
#else
107-
String(localized: "CIFP data could not be parsed.")
107+
"CIFP data could not be parsed."
108108
#endif
109109
case .fileNotFound:
110110
#if canImport(Darwin)
111111
String(localized: "CIFP file was not found.", bundle: .module)
112112
#else
113-
String(localized: "CIFP file was not found.")
113+
"CIFP file was not found."
114114
#endif
115115
case .streamError:
116116
#if canImport(Darwin)
117117
String(localized: "A stream error occurred.", bundle: .module)
118118
#else
119-
String(localized: "A stream error occurred.")
119+
"A stream error occurred."
120120
#endif
121121
case .lineTooShort:
122122
#if canImport(Darwin)
123123
String(localized: "Line was too short.", bundle: .module)
124124
#else
125-
String(localized: "Line was too short.")
125+
"Line was too short."
126126
#endif
127127
case .unknownSectionCode:
128128
#if canImport(Darwin)
129129
String(localized: "Unknown section code.", bundle: .module)
130130
#else
131-
String(localized: "Unknown section code.")
131+
"Unknown section code."
132132
#endif
133133
case .unknownRecordType:
134134
#if canImport(Darwin)
135135
String(localized: "Unknown record type.", bundle: .module)
136136
#else
137-
String(localized: "Unknown record type.")
137+
"Unknown record type."
138138
#endif
139139
case .missingRequiredField:
140140
#if canImport(Darwin)
141141
String(localized: "Required field was missing.", bundle: .module)
142142
#else
143-
String(localized: "Required field was missing.")
143+
"Required field was missing."
144144
#endif
145145
case .unknownSubsectionCode:
146146
#if canImport(Darwin)
147147
String(localized: "Unknown subsection code.", bundle: .module)
148148
#else
149-
String(localized: "Unknown subsection code.")
149+
"Unknown subsection code."
150150
#endif
151151
case .aggregationError:
152152
#if canImport(Darwin)
153153
String(localized: "Record aggregation failed.", bundle: .module)
154154
#else
155-
String(localized: "Record aggregation failed.")
155+
"Record aggregation failed."
156156
#endif
157157
}
158158
}
@@ -161,85 +161,75 @@ public enum CIFPError: Error, LocalizedError, Sendable {
161161
switch self {
162162
case .invalidEncoding:
163163
#if canImport(Darwin)
164-
return String(localized: "The file is not valid ASCII encoding., bundle: .module)
164+
return String(localized: "The file is not valid ASCII encoding.", bundle: .module)
165165
#else
166-
return String(localized: "The file is not valid ASCII encoding.)
166+
return "The file is not valid ASCII encoding."
167167
#endif
168168
case .invalidFormat(let error):
169169
return switch error {
170170
case .missingHeader:
171171
#if canImport(Darwin)
172172
String(
173-
localized: "The CIFP file does not contain valid header records.,
173+
localized: "The CIFP file does not contain valid header records.",
174174
bundle: .module
175175
)
176176
#else
177-
String(
178-
localized: "The CIFP file does not contain valid header records.
179-
)
177+
"The CIFP file does not contain valid header records."
180178
#endif
181179
case .invalidCycleDate:
182180
#if canImport(Darwin)
183-
String(localized: "The cycle date in the header could not be parsed., bundle: .module)
181+
String(localized: "The cycle date in the header could not be parsed.", bundle: .module)
184182
#else
185-
String(localized: "The cycle date in the header could not be parsed.)
183+
"The cycle date in the header could not be parsed."
186184
#endif
187185
case .invalidCoordinate(let value):
188186
#if canImport(Darwin)
189187
String(
190-
localized: "Coordinate value “\(value)” is not in valid HDDDMMSSSS format.,
188+
localized: "Coordinate value “\(value)” is not in valid HDDDMMSSSS format.",
191189
bundle: .module
192190
)
193191
#else
194-
String(
195-
localized: "Coordinate value “\(value)” is not in valid HDDDMMSSSS format.
196-
)
192+
"Coordinate value “\(value)” is not in valid HDDDMMSSSS format."
197193
#endif
198194
case .invalidAltitude(let value):
199195
#if canImport(Darwin)
200-
String(localized: "Altitude value “\(value)” could not be parsed., bundle: .module)
196+
String(localized: "Altitude value “\(value)” could not be parsed.", bundle: .module)
201197
#else
202-
String(localized: "Altitude value “\(value)” could not be parsed.)
198+
"Altitude value “\(value)” could not be parsed."
203199
#endif
204200
case .invalidLatitudeDirection(let char):
205201
#if canImport(Darwin)
206202
String(
207-
localized: "Latitude direction “\(String(char))” is invalid. Expected “N” or “S”.,
203+
localized: "Latitude direction “\(String(char))” is invalid. Expected “N” or “S”.",
208204
bundle: .module
209205
)
210206
#else
211-
String(
212-
localized: "Latitude direction “\(String(char))” is invalid. Expected “N” or “S”.
213-
)
207+
"Latitude direction “\(String(char))” is invalid. Expected “N” or “S”."
214208
#endif
215209
case .invalidLongitudeDirection(let char):
216210
#if canImport(Darwin)
217211
String(
218-
localized: "Longitude direction “\(String(char))” is invalid. Expected “E” or “W”.,
212+
localized: "Longitude direction “\(String(char))” is invalid. Expected “E” or “W”.",
219213
bundle: .module
220214
)
221215
#else
222-
String(
223-
localized: "Longitude direction “\(String(char))” is invalid. Expected “E” or “W”.
224-
)
216+
"Longitude direction “\(String(char))” is invalid. Expected “E” or “W”."
225217
#endif
226218
}
227219
case let .parseError(field, value, line):
228220
#if canImport(Darwin)
229221
return String(
230-
localized: "Failed to parse \(field)\(value)” at line \(line, format: .number).,
222+
localized: "Failed to parse \(field)\(value)” at line \(line, format: .number).",
231223
bundle: .module
232224
)
233225
#else
234-
return String(
235-
localized: "Failed to parse \(field)\(value)” at line \(line, format: .number).
236-
)
226+
return "Failed to parse \(field)\(value)” at line \(line, format: .number)."
237227
#endif
238228
case .fileNotFound(let url):
239229
#if canImport(Darwin)
240-
return String(localized: "The file at “\(url.path)” could not be found., bundle: .module)
230+
return String(localized: "The file at “\(url.path)” could not be found.", bundle: .module)
241231
#else
242-
return String(localized: "The file at “\(url.path)” could not be found.)
232+
return "The file at “\(url.path)” could not be found."
243233
#endif
244234
case .streamError(let error):
245235
#if canImport(Darwin)
@@ -248,9 +238,7 @@ public enum CIFPError: Error, LocalizedError, Sendable {
248238
bundle: .module
249239
)
250240
#else
251-
return String(
252-
localized: "An error occurred while reading: \(error.localizedDescription)"
253-
)
241+
return "An error occurred while reading: \(error.localizedDescription)"
254242
#endif
255243
case let .lineTooShort(expected, actual, line):
256244
#if canImport(Darwin)
@@ -260,126 +248,111 @@ public enum CIFPError: Error, LocalizedError, Sendable {
260248
bundle: .module
261249
)
262250
#else
263-
return String(
264-
localized:
265-
"Line \(line, format: .number) has \(actual, format: .number) characters but \(expected, format: .number) are required."
266-
)
251+
return "Line \(line, format: .number) has \(actual, format: .number) characters but \(expected, format: .number) are required."
267252
#endif
268253
case let .unknownSectionCode(code, line):
269254
#if canImport(Darwin)
270255
return String(
271-
localized: "Unknown section code “\(code)” at line \(line, format: .number).,
256+
localized: "Unknown section code “\(code)” at line \(line, format: .number).",
272257
bundle: .module
273258
)
274259
#else
275-
return String(
276-
localized: "Unknown section code “\(code)” at line \(line, format: .number).
277-
)
260+
return "Unknown section code “\(code)” at line \(line, format: .number)."
278261
#endif
279262
case let .unknownRecordType(type, line):
280263
#if canImport(Darwin)
281264
return String(
282-
localized: "Unknown record type “\(String(type))” at line \(line, format: .number).,
265+
localized: "Unknown record type “\(String(type))” at line \(line, format: .number).",
283266
bundle: .module
284267
)
285268
#else
286-
return String(
287-
localized: "Unknown record type “\(String(type))” at line \(line, format: .number).
288-
)
269+
return "Unknown record type “\(String(type))” at line \(line, format: .number)."
289270
#endif
290271
case let .missingRequiredField(field, recordType, line):
291272
#if canImport(Darwin)
292273
return String(
293274
localized:
294-
"Field “\(field)” is required for \(recordType) at line \(line, format: .number).,
275+
"Field “\(field)” is required for \(recordType) at line \(line, format: .number).",
295276
bundle: .module
296277
)
297278
#else
298-
return String(
299-
localized:
300-
"Field “\(field)” is required for \(recordType) at line \(line, format: .number).
301-
)
279+
return "Field “\(field)” is required for \(recordType) at line \(line, format: .number)."
302280
#endif
303281
case let .unknownSubsectionCode(section, subsection, line):
304282
#if canImport(Darwin)
305283
return String(
306284
localized:
307-
"Unknown subsection “\(String(subsection))” in section “\(section)” at line \(line, format: .number).,
285+
"Unknown subsection “\(String(subsection))” in section “\(section)” at line \(line, format: .number).",
308286
bundle: .module
309287
)
310288
#else
311-
return String(
312-
localized:
313-
"Unknown subsection “\(String(subsection))” in section “\(section)” at line \(line, format: .number).
314-
)
289+
return "Unknown subsection “\(String(subsection))” in section “\(section)” at line \(line, format: .number)."
315290
#endif
316291
case let .aggregationError(recordType, identifier, reason):
317292
let reasonString: String =
318293
switch reason {
319294
case .missingAirwayMetadata:
320295
#if canImport(Darwin)
321-
String(localized: "missing route type or level, bundle: .module)
296+
String(localized: "missing route type or level", bundle: .module)
322297
#else
323-
String(localized: "missing route type or level)
298+
"missing route type or level"
324299
#endif
325300
case .missingMSARadius:
326301
#if canImport(Darwin)
327-
String(localized: "missing radius, bundle: .module)
302+
String(localized: "missing radius", bundle: .module)
328303
#else
329-
String(localized: "missing radius)
304+
"missing radius"
330305
#endif
331306
case .invalidRouteType(let char):
332307
#if canImport(Darwin)
333-
String(localized: "invalid route type “\(String(char)), bundle: .module)
308+
String(localized: "invalid route type “\(String(char))", bundle: .module)
334309
#else
335-
String(localized: "invalid route type “\(String(char)))
310+
"invalid route type “\(String(char))"
336311
#endif
337312
case .missingRouteType:
338313
#if canImport(Darwin)
339-
String(localized: "missing route type, bundle: .module)
314+
String(localized: "missing route type", bundle: .module)
340315
#else
341-
String(localized: "missing route type)
316+
"missing route type"
342317
#endif
343318
case .invalidApproachType(let char):
344319
#if canImport(Darwin)
345-
String(localized: "invalid approach type “\(String(char)), bundle: .module)
320+
String(localized: "invalid approach type “\(String(char))", bundle: .module)
346321
#else
347-
String(localized: "invalid approach type “\(String(char)))
322+
"invalid approach type “\(String(char))"
348323
#endif
349324
case .missingApproachType:
350325
#if canImport(Darwin)
351-
String(localized: "missing approach type, bundle: .module)
326+
String(localized: "missing approach type", bundle: .module)
352327
#else
353-
String(localized: "missing approach type)
328+
"missing approach type"
354329
#endif
355330
case .noBoundaryRecords:
356331
#if canImport(Darwin)
357-
String(localized: "no boundary records, bundle: .module)
332+
String(localized: "no boundary records", bundle: .module)
358333
#else
359-
String(localized: "no boundary records)
334+
"no boundary records"
360335
#endif
361336
case .missingRestrictiveType:
362337
#if canImport(Darwin)
363-
String(localized: "missing restrictive type, bundle: .module)
338+
String(localized: "missing restrictive type", bundle: .module)
364339
#else
365-
String(localized: "missing restrictive type)
340+
"missing restrictive type"
366341
#endif
367342
case .noLegRecords:
368343
#if canImport(Darwin)
369-
String(localized: "no leg records, bundle: .module)
344+
String(localized: "no leg records", bundle: .module)
370345
#else
371-
String(localized: "no leg records)
346+
"no leg records"
372347
#endif
373348
}
374349
#if canImport(Darwin)
375350
return String(
376-
localized: "\(recordType)\(identifier)” could not be built: \(reasonString).,
351+
localized: "\(recordType)\(identifier)” could not be built: \(reasonString).",
377352
bundle: .module
378353
)
379354
#else
380-
return String(
381-
localized: "\(recordType)\(identifier)” could not be built: \(reasonString).
382-
)
355+
return "\(recordType)\(identifier)” could not be built: \(reasonString)."
383356
#endif
384357
}
385358
}
@@ -390,7 +363,7 @@ public enum CIFPError: Error, LocalizedError, Sendable {
390363
#if canImport(Darwin)
391364
String(localized: "Verify the file is a valid FAA CIFP file.", bundle: .module)
392365
#else
393-
String(localized: "Verify the file is a valid FAA CIFP file.")
366+
"Verify the file is a valid FAA CIFP file."
394367
#endif
395368
case .fileNotFound:
396369
#if canImport(Darwin)
@@ -399,9 +372,7 @@ public enum CIFPError: Error, LocalizedError, Sendable {
399372
bundle: .module
400373
)
401374
#else
402-
String(
403-
localized: "Verify that the file exists and has not been moved or deleted."
404-
)
375+
"Verify that the file exists and has not been moved or deleted."
405376
#endif
406377
case .parseError, .streamError, .lineTooShort, .unknownSectionCode, .unknownRecordType,
407378
.missingRequiredField, .unknownSubsectionCode, .aggregationError:

0 commit comments

Comments
 (0)