Skip to content

Commit ee34bd8

Browse files
author
Nick MacCarthy
committed
Fix SwiftLint errors from CI
- Remove trailing whitespace in MetronomeViewModel.swift and Tuning.swift - Fix trailing newline in MetronomeViewModel.swift - Use shorthand operators (+=) in SpectrumAnalyzerView.swift - Use shorthand operator (*=) in TuningMeterView.swift - Exclude Stay_TunedApp from type_name rule (Xcode auto-generated)
1 parent 8e5072a commit ee34bd8

5 files changed

Lines changed: 20 additions & 16 deletions

File tree

.swiftlint.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ disabled_rules:
4242
- function_body_length # Some audio processing functions need to be long
4343
- cyclomatic_complexity # Audio algorithms can be complex
4444

45+
# Type name exceptions (Xcode auto-generates names with underscores)
46+
type_name:
47+
excluded:
48+
- Stay_TunedApp
49+
4550
# Rule configurations
4651
identifier_name:
4752
min_length:

Stay Tuned/Stay Tuned/Models/Tuning.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ struct Tuning: Identifiable, Hashable {
1313
let name: String
1414
let instrument: String // e.g., "Guitar", "Bass", "Ukulele"
1515
let strings: [GuitarString]
16-
16+
1717
/// Find the closest string to a given frequency
1818
func closestString(to frequency: Double) -> GuitarString? {
1919
guard !strings.isEmpty else { return nil }
20-
20+
2121
return strings.min(by: { string1, string2 in
2222
abs(centsDeviation(from: frequency, to: string1.frequency)) <
2323
abs(centsDeviation(from: frequency, to: string2.frequency))
2424
})
2525
}
26-
26+
2727
/// Calculate cents deviation between two frequencies
2828
private func centsDeviation(from detected: Double, to target: Double) -> Double {
2929
guard detected > 0 && target > 0 else { return 0 }

Stay Tuned/Stay Tuned/ViewModels/MetronomeViewModel.swift

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@ import Combine
1111
/// ViewModel for the metronome feature
1212
@MainActor
1313
final class MetronomeViewModel: ObservableObject {
14-
14+
1515
// MARK: - Published Properties
16-
16+
1717
@Published var tempo: Double = 120
1818
@Published var isPlaying = false
1919
@Published var currentBeat: Int = 1
2020
@Published var timeSignature: TimeSignature = .fourFour
2121
@Published var volume: Float = 0.7
22-
22+
2323
// MARK: - Persistence
24-
24+
2525
@AppStorage("metronomeTempo") private var savedTempo: Int = 120
2626
@AppStorage("metronomeTimeSignature") private var savedTimeSignature: String = "4/4"
27-
27+
2828
// MARK: - Private Properties
29-
29+
3030
private let engine = MetronomeEngine()
3131
private var tapTimes: [Date] = []
3232
private let maxTapCount = 4
@@ -160,4 +160,3 @@ final class MetronomeViewModel: ObservableObject {
160160
tempo = max(40, min(240, calculatedBPM))
161161
}
162162
}
163-

Stay Tuned/Stay Tuned/Views/SpectrumAnalyzerView.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,18 +220,18 @@ struct SpectrumAnalyzerView: View {
220220
// Smooth animation
221221
for i in 0..<bandCount {
222222
if newEnergies[i] > bandEnergies[i] {
223-
bandEnergies[i] = bandEnergies[i] + (newEnergies[i] - bandEnergies[i]) * 0.5
223+
bandEnergies[i] += (newEnergies[i] - bandEnergies[i]) * 0.5
224224
} else {
225-
bandEnergies[i] = bandEnergies[i] + (newEnergies[i] - bandEnergies[i]) * 0.12
225+
bandEnergies[i] += (newEnergies[i] - bandEnergies[i]) * 0.12
226226
}
227227
}
228-
228+
229229
// Update overall amplitude
230230
let avgEnergy = totalEnergy / CGFloat(bandCount)
231231
if avgEnergy > smoothedAmplitude {
232-
smoothedAmplitude = smoothedAmplitude + (avgEnergy - smoothedAmplitude) * 0.4
232+
smoothedAmplitude += (avgEnergy - smoothedAmplitude) * 0.4
233233
} else {
234-
smoothedAmplitude = smoothedAmplitude + (avgEnergy - smoothedAmplitude) * 0.1
234+
smoothedAmplitude += (avgEnergy - smoothedAmplitude) * 0.1
235235
}
236236
}
237237

Stay Tuned/Stay Tuned/Views/TuningMeterView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ struct TuningMeterView: View {
210210
var displayCents = animatedCents
211211
if abs(displayCents) <= 7 {
212212
// Within ±5 cents: compress to ±2 visual range (feels more "locked in")
213-
displayCents = displayCents * 0.4
213+
displayCents *= 0.4
214214
}
215215

216216
let normalizedPosition = (displayCents + 50) / 100

0 commit comments

Comments
 (0)