Skip to content

Commit a16c7a1

Browse files
committed
Update swiftformat rules
1 parent 660d8e3 commit a16c7a1

33 files changed

+172
-180
lines changed

.swiftformat

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,12 @@ unusedArguments, \
7676
preferKeyPath
7777

7878
--disable isEmpty, \
79-
indent, \
8079
markTypes, \
8180
organizeDeclarations, \
82-
wrapMultilineStatementBraces, \
83-
wrap, \
84-
linebreakAtEndOfFile, \
8581
numberFormatting, \
86-
opaqueGenericParameters, \
87-
redundantRawValues, \
8882
sortDeclarations, \
8983
sortedSwitchCases, \
90-
trailingClosures, \
91-
wrapSwitchCases, \
92-
wrapEnumCases, \
93-
wrapConditionalBodies, \
94-
yodaConditions
84+
wrapMultilineStatementBraces
9585

9686
# Exclude
9787
--exclude \

SwiftUI-WorkoutApp/Models/EventForm.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ extension EventForm {
3939
/// Готовность формы к созданию нового мероприятия
4040
var isReadyToCreate: Bool {
4141
!title.isEmpty
42-
&& !description.isEmpty
43-
&& sportsGround.id != .zero
42+
&& !description.isEmpty
43+
&& sportsGround.id != .zero
4444
}
4545

4646
/// Готовность формы к отправке обновлений по мероприятию
@@ -54,8 +54,8 @@ extension EventForm {
5454
extension EventForm: Equatable {
5555
static func == (lhs: EventForm, rhs: EventForm) -> Bool {
5656
lhs.title == rhs.title
57-
&& lhs.description == rhs.description
58-
&& lhs.sportsGround.id == rhs.sportsGround.id
59-
&& lhs.date == rhs.date
57+
&& lhs.description == rhs.description
58+
&& lhs.sportsGround.id == rhs.sportsGround.id
59+
&& lhs.date == rhs.date
6060
}
6161
}

SwiftUI-WorkoutApp/Models/EventResponse.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ extension EventResponse {
154154
/// `true` - сервер прислал всю информацию о площадке, `false` - не всю
155155
var isFull: Bool {
156156
participantsCount.valueOrZero > .zero && !participants.isEmpty
157-
|| commentsCount.valueOrZero > .zero && !comments.isEmpty
157+
|| commentsCount.valueOrZero > .zero && !comments.isEmpty
158158
}
159159

160160
static var emptyValue: EventResponse {

SwiftUI-WorkoutApp/Models/MainUserForm.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ extension MainUserForm {
4545
enum Placeholder: String {
4646
case userName = "Логин"
4747
case fullname = "Имя"
48-
case email = "email"
48+
case email
4949
case password = "Пароль (минимум 6 символов)"
5050
case birthDate = "Дата рождения"
5151
case country = "Страна"
@@ -65,19 +65,19 @@ extension MainUserForm {
6565
/// Готовность формы к регистрации нового пользователя
6666
var isReadyToRegister: Bool {
6767
!userName.isEmpty
68-
&& !email.isEmpty
69-
&& password.count >= Constants.minPasswordSize
70-
&& genderCode != Gender.unspecified.code
71-
&& birthDate <= Constants.minUserAge
68+
&& !email.isEmpty
69+
&& password.count >= Constants.minPasswordSize
70+
&& genderCode != Gender.unspecified.code
71+
&& birthDate <= Constants.minUserAge
7272
}
7373

7474
/// Готовность формы к сохранению обновленных данных
7575
var isReadyToSave: Bool {
7676
!userName.isEmpty
77-
&& !email.isEmpty
78-
&& !fullName.isEmpty
79-
&& genderCode != Gender.unspecified.code
80-
&& birthDate <= Constants.minUserAge
77+
&& !email.isEmpty
78+
&& !fullName.isEmpty
79+
&& genderCode != Gender.unspecified.code
80+
&& birthDate <= Constants.minUserAge
8181
}
8282

8383
static var emptyValue: Self {

SwiftUI-WorkoutApp/Models/SportsGround.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ extension SportsGround {
209209
/// `true` - сервер прислал всю информацию о площадке, `false` - не всю
210210
var isFull: Bool {
211211
usersTrainHereCount.valueOrZero > .zero && !participants.isEmpty
212-
|| commentsCount.valueOrZero > .zero && !comments.isEmpty
212+
|| commentsCount.valueOrZero > .zero && !comments.isEmpty
213213
}
214214

215215
static var emptyValue: SportsGround {

SwiftUI-WorkoutApp/Models/SportsGroundForm.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ extension SportsGroundForm {
5151
/// Готовность формы к созданию новой площадки
5252
var isReadyToCreate: Bool {
5353
!address.isEmpty
54-
&& !latitude.isEmpty
55-
&& !longitude.isEmpty
56-
&& cityID != .zero
54+
&& !latitude.isEmpty
55+
&& !longitude.isEmpty
56+
&& cityID != .zero
5757
}
5858

5959
/// Готовность формы к отправке обновлений по площадке
@@ -65,10 +65,10 @@ extension SportsGroundForm {
6565
extension SportsGroundForm: Equatable {
6666
static func == (lhs: SportsGroundForm, rhs: SportsGroundForm) -> Bool {
6767
lhs.address == rhs.address
68-
&& lhs.latitude == rhs.latitude
69-
&& lhs.longitude == rhs.longitude
70-
&& lhs.cityID == rhs.cityID
71-
&& lhs.typeID == rhs.typeID
72-
&& lhs.sizeID == rhs.sizeID
68+
&& lhs.latitude == rhs.latitude
69+
&& lhs.longitude == rhs.longitude
70+
&& lhs.cityID == rhs.cityID
71+
&& lhs.typeID == rhs.typeID
72+
&& lhs.sizeID == rhs.sizeID
7373
}
7474
}

SwiftUI-WorkoutApp/Models/UserModel.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ extension UserModel {
8282

8383
var isFull: Bool {
8484
id != .zero
85-
&& imageURL != nil
86-
&& name != ""
87-
&& age != .zero
88-
&& countryID != .zero
85+
&& imageURL != nil
86+
&& name != ""
87+
&& age != .zero
88+
&& countryID != .zero
8989
}
9090

9191
static var emptyValue: UserModel {

SwiftUI-WorkoutApp/Screens/Common/EmptyContentView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ private extension EmptyContentView {
4949
switch mode {
5050
case .events:
5151
return defaults.hasSportsGrounds && defaults.isAuthorized
52-
? "Создать мероприятие"
53-
: "Выбрать площадку"
52+
? "Создать мероприятие"
53+
: "Выбрать площадку"
5454
case .dialogs:
5555
return defaults.hasFriends ? "Открыть список друзей" : "Найти пользователя"
5656
case .journals: return "Создать дневник"

SwiftUI-WorkoutApp/Screens/Common/SportsGroundLocation/MapSnapshotView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ private extension MapSnapshotView {
7474
}
7575
snapshotImage = image
7676
} else {
77-
#if DEBUG
77+
#if DEBUG
7878
print("--- Error with snapshot: ", (error?.localizedDescription).valueOrEmpty)
79-
#endif
79+
#endif
8080
}
8181
}
8282
}

SwiftUI-WorkoutApp/Screens/Common/TextEntry/TextEntryView.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,22 @@ struct TextEntryView: View {
2121
self.refreshClbk = refreshClbk
2222
switch mode {
2323
case let .editGround(info),
24-
let .editEvent(info),
25-
let .editJournalEntry(info):
24+
let .editEvent(info),
25+
let .editJournalEntry(info):
2626
self.oldEntryText = info.oldEntry
2727
default: break
2828
}
2929
}
3030

3131
var body: some View {
3232
content
33-
.alert(errorTitle, isPresented: $showErrorAlert) {
34-
Button("Ok", action: closeAlert)
35-
}
36-
.onChange(of: viewModel.isSuccess, perform: dismissOnSuccess)
37-
.onChange(of: viewModel.errorMessage, perform: setupErrorAlert)
38-
.onAppear(perform: setupOldEntryIfNeeded)
39-
.onDisappear(perform: cancelTasks)
33+
.alert(errorTitle, isPresented: $showErrorAlert) {
34+
Button("Ok", action: closeAlert)
35+
}
36+
.onChange(of: viewModel.isSuccess, perform: dismissOnSuccess)
37+
.onChange(of: viewModel.errorMessage, perform: setupErrorAlert)
38+
.onAppear(perform: setupOldEntryIfNeeded)
39+
.onDisappear(perform: cancelTasks)
4040
}
4141
}
4242

0 commit comments

Comments
 (0)