Skip to content

Commit 6bf5e8b

Browse files
authored
Merge pull request #954 from GetStream/dev/swiftformat-swiftlint-versions-and-configuration
Use explicit set of rules in SwiftFormat and SwiftLint and bump versions
2 parents a0c90d7 + b710669 commit 6bf5e8b

File tree

108 files changed

+328
-307
lines changed

Some content is hidden

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

108 files changed

+328
-307
lines changed

.swiftformat

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,65 @@
22
--header "\nCopyright © {year} Stream.io Inc. All rights reserved.\n"
33
--swiftversion 5.9
44

5-
--ifdef no-indent
6-
--disable redundantType
7-
--disable extensionAccessControl
8-
--disable andOperator
9-
--disable blankLinesAtStartOfScope
5+
# Use allow-list
6+
--rules blankLinesAroundMark
7+
--rules blankLinesAtEndOfScope
8+
--rules blankLinesBetweenScopes
9+
--rules braces
10+
--rules consecutiveBlankLines
11+
--rules consecutiveSpaces
12+
--rules duplicateImports
13+
--rules elseOnSameLine
14+
--rules emptyBraces
15+
--rules enumNamespaces
16+
--rules fileHeader
17+
--rules indent
18+
--rules initCoderUnavailable
19+
--rules isEmpty
20+
--rules leadingDelimiters
21+
--rules linebreakAtEndOfFile
22+
--rules linebreaks
23+
--rules modifierOrder
24+
--rules numberFormatting
25+
--rules redundantBackticks
26+
--rules redundantBreak
27+
--rules redundantExtensionACL
28+
--rules redundantFileprivate
29+
--rules redundantLet
30+
--rules redundantLetError
31+
--rules redundantNilInit
32+
--rules redundantObjc
33+
--rules redundantPattern
34+
--rules redundantRawValues
35+
--rules redundantVoidReturnType
36+
--rules semicolons
37+
--rules sortImports
38+
--rules spaceAroundBraces
39+
--rules spaceAroundBrackets
40+
--rules spaceAroundComments
41+
--rules spaceAroundGenerics
42+
--rules spaceAroundOperators
43+
--rules spaceAroundParens
44+
--rules spaceInsideBraces
45+
--rules spaceInsideBrackets
46+
--rules spaceInsideComments
47+
--rules spaceInsideGenerics
48+
--rules spaceInsideParens
49+
--rules strongOutlets
50+
--rules strongifiedSelf
51+
--rules todos
52+
--rules trailingCommas
53+
--rules trailingSpace
54+
--rules unusedArguments
55+
--rules void
56+
--rules wrap
57+
--rules wrapArguments
58+
--rules wrapAttributes
59+
--rules yodaConditions
1060

11-
# Rules inferred from Swift Standard Library:
12-
--disable anyObjectProtocol, wrapMultilineStatementBraces
61+
# Configuration for enabled rules
62+
--ifdef no-indent
1363
--indent 4
14-
--enable isEmpty
15-
--disable redundantParens # it generates mistakes for e.g. "if (a || b), let x = ... {}"
1664
--semicolons inline
1765
--nospaceoperators ..., ..< # what about ==, +=?
1866
--commas inline

DemoApp/Sources/Components/DemoAppViewFactory.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ final class DemoAppViewFactory: ViewFactory {
8888
func makeVideoParticipantsView(
8989
viewModel: CallViewModel,
9090
availableFrame: CGRect,
91-
onChangeTrackVisibility: @escaping @MainActor(CallParticipant, Bool) -> Void
91+
onChangeTrackVisibility: @escaping @MainActor (CallParticipant, Bool) -> Void
9292
) -> some View {
9393
VideoParticipantsView(
9494
viewFactory: self,

DemoApp/Sources/Components/MemoryLogDestination/LogQueue.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ enum LogQueue {
2828
let logContent = """
2929
Stream Video Logs - Generated: \(Date())
3030
\(logs.reversed().map { "\($0.level) - [\($0.fileName):\($0.lineNumber):\($0.functionName)] \($0.message)" }
31-
.joined(separator: "\n"))
31+
.joined(separator: "\n")
32+
)
3233
"""
3334

3435
try logContent.write(to: fileURL, atomically: true, encoding: .utf8)

DemoApp/Sources/Components/MemoryLogDestination/MemoryLogViewer.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ struct MemoryLogViewer: View {
8383
let logContent = """
8484
Stream Video Logs - Generated: \(Date())
8585
\(logs.reversed().map { "\($0.level) - [\($0.fileName):\($0.lineNumber):\($0.functionName)] \($0.message)" }
86-
.joined(separator: "\n"))
86+
.joined(separator: "\n")
87+
)
8788
"""
8889

8990
// Write to file

DemoApp/Sources/Components/Router.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ final class Router: ObservableObject {
3838

3939
if
4040
appState.unsecureRepository.currentConfiguration() != AppEnvironment.configuration
41-
|| appState.unsecureRepository.currentBaseURL() != AppEnvironment.baseURL
42-
{
41+
|| appState.unsecureRepository.currentBaseURL() != AppEnvironment.baseURL {
4342
// Clean up the currently logged in use, if we run in different
4443
// configuration since the last time.
4544
appState.unsecureRepository.removeCurrentUser()

DemoApp/Sources/Extensions/View+AlertWithTextField.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import SwiftUI
88
private struct DemoAlertWithTextFieldViewModifier<Value: CustomStringConvertible>: ViewModifier {
99

1010
var title: String
11-
var message: String? = nil
11+
var message: String?
1212
var placeholder: String
1313
var presentationBinding: Binding<Bool>
1414
var valueBinding: Binding<Value>

DemoApp/Sources/Views/Login/LoginView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ struct AppUserView: View {
215215
@Injected(\.colors) var colors
216216
var user: User
217217
var size: CGFloat = 32
218-
var overrideUserName: String? = nil
218+
var overrideUserName: String?
219219

220220
var body: some View {
221221
if user.imageURL != nil {

DemoApp/Sources/Views/StatsView/DemoStatsView.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,7 @@ struct DemoStatsView: View {
185185
)
186186
if
187187
resolution != .zero,
188-
report.highestFramesPerSecond > 0
189-
{
188+
report.highestFramesPerSecond > 0 {
190189
return "\(Int(resolution.width))x\(Int(resolution.height))@\(report.highestFramesPerSecond)"
191190
} else {
192191
return "none"

Githubfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ export MINT_VERSION='0.17.5'
99
export SONAR_VERSION='6.2.1.4610'
1010
export IPSW_VERSION='3.1.592'
1111
export INTERFACE_ANALYZER_VERSION='1.0.7'
12-
export SWIFT_LINT_VERSION='0.55.1'
13-
export SWIFT_FORMAT_VERSION='0.47.12'
12+
export SWIFT_LINT_VERSION='0.59.1'
13+
export SWIFT_FORMAT_VERSION='0.58.2'
1414
export SWIFT_GEN_VERSION='6.5.1'

Sources/StreamVideo/CallKit/CallKitAdapter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ open class CallKitAdapter {
8686

8787
extension CallKitAdapter: InjectionKey {
8888
/// Provides the current instance of `CallKitAdapter`.
89-
nonisolated(unsafe) public static var currentValue: CallKitAdapter = .init()
89+
public nonisolated(unsafe) static var currentValue: CallKitAdapter = .init()
9090
}
9191

9292
extension InjectedValues {

0 commit comments

Comments
 (0)