Skip to content

Commit 8769678

Browse files
🤖 CI: Add SwiftLint workflow
- Address lint errors
1 parent 3410ff4 commit 8769678

File tree

5 files changed

+54
-16
lines changed

5 files changed

+54
-16
lines changed

.github/workflows/swiftlint.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: SwiftLint
2+
3+
on:
4+
pull_request:
5+
branches: [ "main" ]
6+
7+
jobs:
8+
lint:
9+
runs-on: macos-latest
10+
11+
steps:
12+
- name: Check out code
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Ruby
16+
uses: ruby/setup-ruby@v1
17+
with:
18+
ruby-version: '3.3.5' # latest stable as of 2 November 2024
19+
20+
- name: Install SwiftLint
21+
run: brew install swiftlint
22+
23+
- name: Run SwiftLint
24+
run: swiftlint --strict

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ xcuserdata/
1010
*.xcworkspacedata
1111
*.DS_Store
1212

13-
*SpotifyConfig.swift
13+
*.build

.swiftlint.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
disabled_rules:
2+
- trailing_whitespace
3+
- trailing_comma
4+
- void_function_in_ternary
5+
# - force_cast
6+
7+
opt_in_rules:
8+
- closure_spacing
9+
- identifier_name
10+
11+
# Customize line length settings
12+
line_length:
13+
warning: 110
14+
error: 150
15+
ignores_comments: true

Sources/Control/Extensions/BetweenZeroAndOneInclusive.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// ControlKit
44
//
55

6-
76
@propertyWrapper
87
struct BetweenZeroAndOneInclusive {
98
private var value: Float

Sources/Controllers/SystemController.swift

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import SwiftUI
1010
@MainActor
1111
public final class SystemController: ObservableObject {
1212

13-
public enum PlaybackType { case AppleMusic, Spotify, AVAudio }
13+
public enum PlaybackType { case appleMusic, spotify, avAudio }
1414

15-
@Published public var selectedPlaybackType: PlaybackType = .AVAudio
15+
@Published public var selectedPlaybackType: PlaybackType = .avAudio
1616

1717
@Published public var isAudioPlaying = false
1818
@Published public var isMuted = false
@@ -31,11 +31,11 @@ extension SystemController: @preconcurrency PlaybackController {
3131
public func togglePlayPause() {
3232
switch selectedPlaybackType {
3333

34-
case .AppleMusic:
34+
case .appleMusic:
3535
appleMusic.togglePlayPause()
36-
case .Spotify:
36+
case .spotify:
3737
spotify.togglePlayPause()
38-
case .AVAudio:
38+
case .avAudio:
3939
Control.Playback.togglePlayPause()
4040
}
4141

@@ -45,11 +45,11 @@ extension SystemController: @preconcurrency PlaybackController {
4545
public func skipToNextTrack() {
4646
switch selectedPlaybackType {
4747

48-
case .AppleMusic:
48+
case .appleMusic:
4949
appleMusic.skipToNextTrack()
50-
case .Spotify:
50+
case .spotify:
5151
spotify.skipToNextTrack()
52-
case .AVAudio:
52+
case .avAudio:
5353
appleMusic.skipToNextTrack()
5454
spotify.skipToNextTrack()
5555
}
@@ -58,11 +58,11 @@ extension SystemController: @preconcurrency PlaybackController {
5858
public func skipToPreviousTrack() {
5959
switch selectedPlaybackType {
6060

61-
case .AppleMusic:
61+
case .appleMusic:
6262
appleMusic.skipToPreviousTrack()
63-
case .Spotify:
63+
case .spotify:
6464
spotify.skipToPreviousTrack()
65-
case .AVAudio:
65+
case .avAudio:
6666
appleMusic.skipToPreviousTrack()
6767
spotify.skipToPreviousTrack()
6868
}
@@ -71,11 +71,11 @@ extension SystemController: @preconcurrency PlaybackController {
7171
private func updateIsAudioPlaying() {
7272
switch selectedPlaybackType {
7373

74-
case .AppleMusic:
74+
case .appleMusic:
7575
isAudioPlaying = appleMusic.isPlaying
76-
case .Spotify:
76+
case .spotify:
7777
isAudioPlaying = spotify.isPlaying
78-
case .AVAudio:
78+
case .avAudio:
7979
isAudioPlaying = Control.Playback.isAudioPlaying
8080
}
8181
}

0 commit comments

Comments
 (0)