Skip to content

Commit 3c26067

Browse files
Adjust linter rules and linted paths (#3835)
* Remove trailing_whitespace from SwiftLint rules due to multi-line string issues * Lint everything * Fix linting issues * Fix podspecs linting * Fix issue * Rename deprecated rule name * Remove isEmpty because it does not work with XCUIElementQuery --------- Co-authored-by: Alexey Alter-Pesotskiy <[email protected]>
1 parent 470b45b commit 3c26067

File tree

148 files changed

+1090
-1146
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+1090
-1146
lines changed

.swiftformat

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
--rules fileHeader
1818
--rules indent
1919
--rules initCoderUnavailable
20-
--rules isEmpty
2120
--rules leadingDelimiters
2221
--rules linebreakAtEndOfFile
2322
--rules linebreaks
@@ -35,7 +34,7 @@
3534
--rules redundantRawValues
3635
--rules redundantVoidReturnType
3736
--rules semicolons
38-
--rules sortedImports
37+
--rules sortImports
3938
--rules spaceAroundBraces
4039
--rules spaceAroundBrackets
4140
--rules spaceAroundComments
@@ -81,4 +80,4 @@
8180
--wrapcollections before-first
8281

8382
# Exclude paths
84-
--exclude **/Generated,Sources/StreamChatUI/StreamNuke,Sources/StreamChatUI/StreamSwiftyGif,Sources/StreamChatUI/StreamDifferenceKit
83+
--exclude **/Generated,Sources/StreamChatUI/StreamNuke,Sources/StreamChatUI/StreamSwiftyGif,Sources/StreamChatUI/StreamDifferenceKit,vendor/bundle,Pods,spm_cache,derived_data,.build

.swiftlint.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
excluded:
22
- Scripts
3-
- Package.swift
4-
- Dependencies
53
- Sources/StreamChatUI/Generated
64
- Sources/StreamChatUI/StreamSwiftyGif
75
- Sources/StreamChatUI/StreamNuke
86
- Sources/StreamChat/StreamStarscream
97
- Sources/StreamChatUI/StreamDifferenceKit
10-
- vendor
118
- UISDKdocumentation
129
- Tests
13-
- TestTools
1410
- Pods
1511
- .build
1612
- spm_cache
1713
- vendor/bundle
18-
- .ruby-lsp
1914
- derived_data
2015

2116
only_rules:
@@ -56,7 +51,6 @@ only_rules:
5651
- trailing_comma
5752
- trailing_newline
5853
- trailing_semicolon
59-
- trailing_whitespace
6054
- unneeded_break_in_switch
6155
- unneeded_override
6256
- unused_closure_parameter
@@ -68,9 +62,6 @@ only_rules:
6862
multiline_arguments:
6963
only_enforce_after_first_closure_on_first_line: true
7064

71-
trailing_whitespace:
72-
ignores_empty_lines: true
73-
7465
file_name_no_space:
7566
severity: error
7667

DemoShare/DemoShareView.swift

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import StreamChatUI
77
import SwiftUI
88

99
struct DemoShareView: View {
10-
1110
@StateObject var viewModel: DemoShareViewModel
1211

1312
init(
@@ -42,7 +41,7 @@ struct DemoShareView: View {
4241
.padding(.vertical)
4342

4443
HStack {
45-
if viewModel.channels.count == 0 {
44+
if viewModel.channels.isEmpty {
4645
ProgressView()
4746
} else {
4847
Text("Select a channel")
@@ -61,7 +60,6 @@ struct DemoShareView: View {
6160
}
6261

6362
struct TopView: View {
64-
6563
@ObservedObject var viewModel: DemoShareViewModel
6664

6765
var body: some View {
@@ -89,7 +87,6 @@ struct TopView: View {
8987
}
9088
})
9189
.disabled(viewModel.selectedChannel == nil)
92-
9390
}
9491
.padding(.vertical, 8)
9592
.padding(.horizontal, 16)
@@ -102,7 +99,6 @@ struct TopView: View {
10299
}
103100

104101
struct ImageToShareView: View {
105-
106102
private let imageHeight: CGFloat = 180
107103

108104
var image: UIImage
@@ -115,11 +111,9 @@ struct ImageToShareView: View {
115111
.frame(height: imageHeight)
116112
.cornerRadius(8)
117113
}
118-
119114
}
120115

121116
struct ShareChannelsView: View {
122-
123117
@ObservedObject var viewModel: DemoShareViewModel
124118

125119
var body: some View {
@@ -149,7 +143,6 @@ struct ShareChannelsView: View {
149143
}
150144
}
151145
}
152-
153146
}
154147

155148
extension ChatChannel: Identifiable {

DemoShare/DemoShareViewModel.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44

55
import Combine
66
import CoreServices
7-
import UIKit
8-
import StreamChat
97
import Social
8+
import StreamChat
9+
import UIKit
1010

1111
@MainActor
1212
class DemoShareViewModel: ObservableObject, ChatChannelControllerDelegate {
13-
1413
private let chatClient: ChatClient
1514
private let userCredentials: UserCredentials
1615
private var channelListController: ChatChannelListController?

DemoShare/ShareViewController.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
// Copyright © 2025 Stream.io Inc. All rights reserved.
33
//
44

5-
import UIKit
5+
import CoreServices
66
import Social
77
import StreamChat
88
import SwiftUI
9-
import CoreServices
9+
import UIKit
1010

1111
class ShareViewController: UIViewController {
12-
1312
override func viewDidLoad() {
1413
super.viewDidLoad()
1514

Examples/EdgeCases/ViewController.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,4 @@
44

55
import UIKit
66

7-
class ViewController: UIViewController {
8-
override func viewDidLoad() {
9-
super.viewDidLoad()
10-
// Do any additional setup after loading the view.
11-
}
12-
}
7+
class ViewController: UIViewController {}

Examples/YouTubeClone/Composer/YTChatComposerViewController.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ final class YTChatComposerViewController: ComposerVC {
5858
preferredStyle: .actionSheet
5959
)
6060
["😃", "😇", "😅", "😂"].forEach { emoji in
61-
6261
let action = UIAlertAction(title: emoji, style: .default) { _ in
6362
let inputTextView = self.composerView.inputMessageView.textView
6463
inputTextView.replaceSelectedText(emoji)

Examples/iMessageClone/iMessageComposerVC.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ final class iMessageComposerVC: ComposerVC {
3535
)
3636

3737
["😃", "😇", "😅", "😂"].forEach { emoji in
38-
3938
let action = UIAlertAction(title: emoji, style: .default) { _ in
4039
let inputTextView = self.composerView.inputMessageView.textView
4140
inputTextView.replaceSelectedText(emoji)

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ let package = Package(
2525
.library(
2626
name: "StreamChatTestMockServer",
2727
targets: ["StreamChatTestMockServer"]
28-
),
28+
)
2929
],
3030
targets: [
3131
.target(
@@ -52,7 +52,7 @@ let package = Package(
5252
path: "TestTools/StreamChatTestMockServer",
5353
exclude: ["Info.plist"],
5454
resources: [.process("Fixtures")]
55-
),
55+
)
5656
]
5757
)
5858

Stream.playground/Contents.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1+
//
2+
// Copyright © 2025 Stream.io Inc. All rights reserved.
3+
//
4+
15
import PlaygroundSupport
2-
import UIKit
36
import StreamChat
47
import StreamChatUI
8+
import UIKit
59

610
PlaygroundPage.current.needsIndefiniteExecution = true
711
/*:
812
# Stream Playground
913
Playground used for testing the StreamChat and StreamChatUI components of the SDK.
1014

1115
⚠️ Please, feel free to change the playground and test different components, but do not commit the changes.
12-
*/
16+
*/
1317
let apiKeyString = "8br4watad788"
1418

1519
LogConfig.level = .info

0 commit comments

Comments
 (0)