Skip to content

Commit 656a0bc

Browse files
committed
Настроил правила и запустил swiftformat
1 parent b75fa8c commit 656a0bc

File tree

82 files changed

+584
-253
lines changed

Some content is hidden

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

82 files changed

+584
-253
lines changed

.swiftformat

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
--commas inline
2+
--groupedextension "MARK: %c"
3+
--header strip
4+
--markextensions if-not-empty
5+
--redundanttype inferred
6+
--self init-only
7+
--semicolons never
8+
--typeattributes prev-line
9+
--lineaftermarks false
10+
--linebreaks lf
11+
--ifdef no-indent
12+
--xcodeindentation enabled
13+
14+
--funcattributes prev-line
15+
--typeattributes prev-line
16+
--varattributes preserve
17+
18+
--maxwidth 140
19+
--wraparguments before-first
20+
--wrapparameters before-first
21+
--wrapcollections before-first
22+
--wrapternary before-operators
23+
24+
--enable anyObjectProtocol, \
25+
assertionFailures, \
26+
blankLinesAroundMark, \
27+
blankLinesAtStartOfScope, \
28+
blankLinesAtEndOfScope, \
29+
blankLinesBetweenScopes, \
30+
blankLinesBetweenImports, \
31+
blankLineAfterImports, \
32+
duplicateImports, \
33+
elseOnSameLine, \
34+
enumNamespaces, \
35+
initCoderUnavailable, \
36+
leadingDelimiters, \
37+
modifierOrder, \
38+
redundantBackticks, \
39+
redundantBreak, \
40+
redundantGet, \
41+
redundantLet, \
42+
redundantObjc, \
43+
redundantOptionalBinding, \
44+
sortedImports, \
45+
spaceAroundBraces, \
46+
spaceInsideGenerics, \
47+
strongifiedSelf, \
48+
todos, \
49+
typeSugar, \
50+
consecutiveBlankLines, \
51+
andOperator, \
52+
blockComments, \
53+
consecutiveSpaces, \
54+
emptyBraces, \
55+
genericExtensions, \
56+
hoistPatternLet, \
57+
redundantClosure, \
58+
redundantExtensionACL, \
59+
redundantFileprivate, \
60+
redundantInit, \
61+
redundantLetError, \
62+
redundantNilInit, \
63+
redundantParens, \
64+
redundantPattern, \
65+
redundantVoidReturnType, \
66+
spaceAroundBrackets, \
67+
spaceAroundComments, \
68+
spaceAroundGenerics, \
69+
spaceAroundOperators, \
70+
spaceAroundParens, \
71+
spaceInsideBraces, \
72+
spaceInsideBrackets, \
73+
spaceInsideComments, \
74+
spaceInsideParens, \
75+
unusedArguments, \
76+
preferKeyPath
77+
78+
--disable isEmpty, \
79+
indent, \
80+
markTypes, \
81+
organizeDeclarations, \
82+
wrapMultilineStatementBraces, \
83+
wrap, \
84+
linebreakAtEndOfFile, \
85+
numberFormatting, \
86+
opaqueGenericParameters, \
87+
redundantRawValues, \
88+
sortDeclarations, \
89+
sortedSwitchCases, \
90+
trailingClosures, \
91+
wrapSwitchCases, \
92+
wrapEnumCases, \
93+
wrapConditionalBodies, \
94+
yodaConditions
95+
96+
# Exclude
97+
--exclude \
98+
# someFolder, \
99+
SnapshotHelper.swift

SwiftUI-WorkoutApp/Constants.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ enum Constants {
1717
static let registrationForm = "Принимаю условия **[пользовательского соглашения](https://workout.su/pravila)**"
1818
static let aboutApp = URL(string: "https://workout.su/pravila")!
1919
}
20-
20+
2121
enum Alert {
2222
static let forgotPassword = "Для восстановления пароля введите логин или email"
2323
static let friendRequestSent = "Запрос отправлен!"

SwiftUI-WorkoutApp/DateFormatterService/Package.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ let package = Package(
1010
// Products define the executables and libraries a package produces, and make them visible to other packages.
1111
.library(
1212
name: "DateFormatterService",
13-
targets: ["DateFormatterService"]),
13+
targets: ["DateFormatterService"]
14+
)
1415
],
1516
dependencies: [
1617
// Dependencies declare other packages that this package depends on.
@@ -22,9 +23,11 @@ let package = Package(
2223
// Targets can depend on other targets in this package, and on products in packages this package depends on.
2324
.target(
2425
name: "DateFormatterService",
25-
dependencies: ["Utils"]),
26+
dependencies: ["Utils"]
27+
),
2628
.testTarget(
2729
name: "DateFormatterServiceTests",
28-
dependencies: ["DateFormatterService"]),
30+
dependencies: ["DateFormatterService"]
31+
)
2932
]
3033
)

SwiftUI-WorkoutApp/DateFormatterService/Sources/DateFormatterService/DateFormatterService.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ public enum DateFormatterService {
4545
}
4646
}
4747

48-
extension DateFormatterService {
49-
public enum DateFormat: String {
48+
public extension DateFormatterService {
49+
enum DateFormat: String {
5050
case isoShortDate = "yyyy-MM-dd"
5151
case serverDateTimeSec = "yyyy-MM-dd'T'HH:mm:ss"
5252
case isoDateTimeSec = "yyyy-MM-dd'T'HH:mm:ss.SSS"

SwiftUI-WorkoutApp/DateFormatterService/Tests/DateFormatterServiceTests/DateFormatterServiceTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import XCTest
21
@testable import DateFormatterService
2+
import XCTest
33

44
final class DateFormatterServiceTests: XCTestCase {
55
func testReadableDate() {

SwiftUI-WorkoutApp/Extensions/Text+.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import SwiftUI
22

33
extension Text {
44
func blueMediumWeight() -> Text {
5-
self
6-
.fontWeight(.medium)
5+
fontWeight(.medium)
76
.foregroundColor(.blue)
87
}
98
}

SwiftUI-WorkoutApp/Models/City.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ struct City: Codable, Identifiable, Hashable {
55

66
init(id: String) {
77
self.id = id
8-
name = ""
9-
lat = ""
10-
lon = ""
8+
self.name = ""
9+
self.lat = ""
10+
self.lon = ""
1111
}
1212

1313
init(id: String, name: String, lat: String, lon: String) {

SwiftUI-WorkoutApp/Models/DialogResponse.swift

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import Foundation
21
import DateFormatterService
2+
import Foundation
33

44
/// Модель с информацией о диалоге
55
struct DialogResponse: Codable, Identifiable {
@@ -28,19 +28,31 @@ extension DialogResponse {
2828
var anotherUserImageURL: URL? {
2929
.init(string: anotherUserImageStringURL.valueOrEmpty)
3030
}
31+
3132
var lastMessageFormatted: String {
3233
lastMessageText.valueOrEmpty
3334
.withoutHTML
3435
.trimmingCharacters(in: .whitespacesAndNewlines)
3536
}
37+
3638
var lastMessageDateString: String {
3739
DateFormatterService.readableDate(from: lastMessageDate)
3840
}
41+
3942
var unreadMessagesCount: Int {
4043
get { unreadCountOptional.valueOrZero }
4144
set { unreadCountOptional = newValue }
4245
}
46+
4347
static var emptyValue: DialogResponse {
44-
.init(id: .zero, anotherUserImageStringURL: nil, anotherUserName: nil, lastMessageText: nil, lastMessageDate: nil, anotherUserID: nil, createdDate: nil)
48+
.init(
49+
id: .zero,
50+
anotherUserImageStringURL: nil,
51+
anotherUserName: nil,
52+
lastMessageText: nil,
53+
lastMessageDate: nil,
54+
anotherUserID: nil,
55+
createdDate: nil
56+
)
4557
}
4658
}

SwiftUI-WorkoutApp/Models/ErrorResponse.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ struct ErrorResponse: Codable {
77
let type: String?
88

99
var realCode: Int {
10-
if let code = code, code != .zero {
10+
if let code, code != .zero {
1111
return code
1212
} else {
1313
return status.valueOrZero

SwiftUI-WorkoutApp/Models/EventForm.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import Foundation
21
import DateFormatterService
2+
import Foundation
33

44
/// Форма для отправки создании/изменении мероприятия
55
struct EventForm: Codable {

0 commit comments

Comments
 (0)