Skip to content

Commit bcd3af9

Browse files
committed
fix multiline parameter alignment for better readability
- enable `multiline_arguments_brackets` swiftlint rule
1 parent 4477298 commit bcd3af9

77 files changed

Lines changed: 1002 additions & 617 deletions

File tree

Some content is hidden

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

.swiftlint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ opt_in_rules:
2626
- convenience_type
2727
- pattern_matching_keywords
2828
- multiline_parameters_brackets
29+
- multiline_arguments_brackets
2930

3031
custom_rules:
3132
spaces_over_tabs:

CodeEdit/AppDelegate.swift

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ final class CodeEditApplication: NSApplication {
2525
}
2626

2727
@NSApplicationMain
28-
final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
28+
final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject { // swiftlint:disable:this type_body_length
2929
var updater: SoftwareUpdater = SoftwareUpdater()
3030

3131
func applicationWillFinishLaunching(_ notification: Notification) {
@@ -44,9 +44,11 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
4444
!projects.isEmpty {
4545
projects.forEach { path in
4646
let url = URL(fileURLWithPath: path)
47-
CodeEditDocumentController.shared.reopenDocument(for: url,
48-
withContentsOf: url,
49-
display: true) { document, _, _ in
47+
CodeEditDocumentController.shared.reopenDocument(
48+
for: url,
49+
withContentsOf: url,
50+
display: true
51+
) { document, _, _ in
5052
document?.windowControllers.first?.synchronizeWindowTitleWithDocumentName()
5153
}
5254
}
@@ -60,9 +62,11 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
6062
let path = CommandLine.arguments[index+1]
6163
let url = URL(fileURLWithPath: path)
6264

63-
CodeEditDocumentController.shared.reopenDocument(for: url,
64-
withContentsOf: url,
65-
display: true) { document, _, _ in
65+
CodeEditDocumentController.shared.reopenDocument(
66+
for: url,
67+
withContentsOf: url,
68+
display: true
69+
) { document, _, _ in
6670
document?.windowControllers.first?.synchronizeWindowTitleWithDocumentName()
6771
}
6872

@@ -215,9 +219,10 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
215219
CodeEditDocumentController.shared.reopenDocument(
216220
for: fileURL,
217221
withContentsOf: fileURL,
218-
display: true) { document, _, _ in
219-
document?.windowControllers.first?.synchronizeWindowTitleWithDocumentName()
220-
}
222+
display: true
223+
) { document, _, _ in
224+
document?.windowControllers.first?.synchronizeWindowTitleWithDocumentName()
225+
}
221226
}
222227

223228
defaults.removeObject(forKey: "openInCEFiles")
@@ -256,8 +261,10 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
256261
Preferences.Pane(
257262
identifier: Preferences.PaneIdentifier("Navigation"),
258263
title: "Navigation",
259-
toolbarIcon: NSImage(systemSymbolName: "arrow.triangle.turn.up.right.diamond",
260-
accessibilityDescription: nil)!
264+
toolbarIcon: NSImage(
265+
systemSymbolName: "arrow.triangle.turn.up.right.diamond",
266+
accessibilityDescription: nil
267+
)!
261268
) {
262269
PreferencesPlaceholderView()
263270
},

CodeEdit/Features/About/Views/AboutView.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,10 @@ public struct AboutView: View {
8888
}
8989

9090
public func showWindow(width: CGFloat, height: CGFloat) {
91-
AboutViewWindowController(view: self,
92-
size: NSSize(width: width,
93-
height: height))
91+
AboutViewWindowController(
92+
view: self,
93+
size: NSSize(width: width, height: height)
94+
)
9495
.showWindow(nil)
9596
}
9697
}

CodeEdit/Features/AppPreferences/Model/Accounts/AccountsPreferences.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ extension AppPreferences {
2020
/// Explicit decoder init for setting default values when key is not present in `JSON`
2121
init(from decoder: Decoder) throws {
2222
let container = try decoder.container(keyedBy: CodingKeys.self)
23-
self.sourceControlAccounts = try container.decodeIfPresent(GitAccounts.self,
24-
forKey: .sourceControlAccounts) ?? .init()
23+
self.sourceControlAccounts = try container.decodeIfPresent(
24+
GitAccounts.self,
25+
forKey: .sourceControlAccounts
26+
) ?? .init()
2527
}
2628
}
2729

CodeEdit/Features/AppPreferences/Model/AppPreferences.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ struct AppPreferences: Codable {
5454
self.theme = try container.decodeIfPresent(ThemePreferences.self, forKey: .theme) ?? .init()
5555
self.terminal = try container.decodeIfPresent(TerminalPreferences.self, forKey: .terminal) ?? .init()
5656
self.textEditing = try container.decodeIfPresent(TextEditingPreferences.self, forKey: .textEditing) ?? .init()
57-
self.sourceControl = try container.decodeIfPresent(SourceControlPreferences.self,
58-
forKey: .sourceControl) ?? .init()
57+
self.sourceControl = try container.decodeIfPresent(
58+
SourceControlPreferences.self,
59+
forKey: .sourceControl
60+
) ?? .init()
5961
self.keybindings = try container.decodeIfPresent(KeybindingsPreferences.self, forKey: .keybindings) ?? .init()
6062
}
6163
}

CodeEdit/Features/AppPreferences/Model/Keybindings/KeybindingsPreferences.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,20 @@ extension AppPreferences {
2222
/// Explicit decoder init for setting default values when key is not present in `JSON`
2323
init(from decoder: Decoder) throws {
2424
let container = try decoder.container(keyedBy: CodingKeys.self)
25-
self.keybindings = try container.decodeIfPresent([String: KeyboardShortcutWrapper].self,
26-
forKey: .keybindings) ?? .init()
25+
self.keybindings = try container.decodeIfPresent(
26+
[String: KeyboardShortcutWrapper].self,
27+
forKey: .keybindings
28+
) ?? .init()
2729
appendNew()
2830

2931
let mgr = CommandManager.shared
3032
let wrap = CommandClosureWrapper.init(closure: {
3133
print("testing closure")
3234
})
33-
mgr.addCommand(name: "Send test to console",
34-
title: "Send test to console", id: "codeedit.test", command: wrap)
35+
mgr.addCommand(
36+
name: "Send test to console",
37+
title: "Send test to console", id: "codeedit.test", command: wrap
38+
)
3539
mgr.executeCommand(name: "test")
3640
}
3741

CodeEdit/Features/AppPreferences/Model/Source Control/SourceControlPreferences.swift

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,35 @@ extension AppPreferences {
5454
let container = try decoder.container(keyedBy: CodingKeys.self)
5555
self.enableSourceControl = try container.decodeIfPresent(Bool.self, forKey: .enableSourceControl) ?? true
5656
self.refreshStatusLocaly = try container.decodeIfPresent(Bool.self, forKey: .refreshStatusLocaly) ?? true
57-
self.fetchRefreshServerStatus = try container.decodeIfPresent(Bool.self,
58-
forKey: .fetchRefreshServerStatus) ?? true
59-
self.addRemoveAutomatically = try container.decodeIfPresent(Bool.self,
60-
forKey: .addRemoveAutomatically) ?? true
57+
self.fetchRefreshServerStatus = try container.decodeIfPresent(
58+
Bool.self,
59+
forKey: .fetchRefreshServerStatus
60+
) ?? true
61+
self.addRemoveAutomatically = try container.decodeIfPresent(
62+
Bool.self,
63+
forKey: .addRemoveAutomatically
64+
) ?? true
6165
self.selectFilesToCommit = try container.decodeIfPresent(Bool.self, forKey: .selectFilesToCommit) ?? true
62-
self.showSourceControlChanges = try container.decodeIfPresent(Bool.self,
63-
forKey: .showSourceControlChanges) ?? true
64-
self.includeUpstreamChanges = try container.decodeIfPresent(Bool.self,
65-
forKey: .includeUpstreamChanges) ?? true
66-
self.openFeedbackInBrowser = try container.decodeIfPresent(Bool.self,
67-
forKey: .openFeedbackInBrowser) ?? true
68-
self.revisionComparisonLayout = try container.decodeIfPresent(RevisionComparisonLayout.self,
69-
forKey: .revisionComparisonLayout) ?? .localLeft
70-
self.controlNavigatorOrder = try container.decodeIfPresent(ControlNavigatorOrder.self,
71-
forKey: .controlNavigatorOrder) ?? .sortByName
66+
self.showSourceControlChanges = try container.decodeIfPresent(
67+
Bool.self,
68+
forKey: .showSourceControlChanges
69+
) ?? true
70+
self.includeUpstreamChanges = try container.decodeIfPresent(
71+
Bool.self,
72+
forKey: .includeUpstreamChanges
73+
) ?? true
74+
self.openFeedbackInBrowser = try container.decodeIfPresent(
75+
Bool.self,
76+
forKey: .openFeedbackInBrowser
77+
) ?? true
78+
self.revisionComparisonLayout = try container.decodeIfPresent(
79+
RevisionComparisonLayout.self,
80+
forKey: .revisionComparisonLayout
81+
) ?? .localLeft
82+
self.controlNavigatorOrder = try container.decodeIfPresent(
83+
ControlNavigatorOrder.self,
84+
forKey: .controlNavigatorOrder
85+
) ?? .sortByName
7286
self.defaultBranchName = try container.decodeIfPresent(String.self, forKey: .defaultBranchName) ?? "main"
7387
}
7488
}
@@ -107,12 +121,18 @@ extension AppPreferences {
107121
let container = try decoder.container(keyedBy: CodingKeys.self)
108122
self.authorName = try container.decodeIfPresent(String.self, forKey: .authorName) ?? ""
109123
self.authorEmail = try container.decodeIfPresent(String.self, forKey: .authorEmail) ?? ""
110-
self.ignoredFiles = try container.decodeIfPresent([IgnoredFiles].self,
111-
forKey: .ignoredFiles) ?? []
112-
self.preferRebaseWhenPulling = try container.decodeIfPresent(Bool.self,
113-
forKey: .preferRebaseWhenPulling) ?? false
114-
self.showMergeCommitsPerFileLog = try container.decodeIfPresent(Bool.self,
115-
forKey: .showMergeCommitsPerFileLog) ?? false
124+
self.ignoredFiles = try container.decodeIfPresent(
125+
[IgnoredFiles].self,
126+
forKey: .ignoredFiles
127+
) ?? []
128+
self.preferRebaseWhenPulling = try container.decodeIfPresent(
129+
Bool.self,
130+
forKey: .preferRebaseWhenPulling
131+
) ?? false
132+
self.showMergeCommitsPerFileLog = try container.decodeIfPresent(
133+
Bool.self,
134+
forKey: .showMergeCommitsPerFileLog
135+
) ?? false
116136
}
117137
}
118138
}

CodeEdit/Features/AppPreferences/Model/Text Editing/TextEditingPreferences.swift

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,21 @@ extension AppPreferences {
4141
self.defaultTabWidth = try container.decodeIfPresent(Int.self, forKey: .defaultTabWidth) ?? 4
4242
self.font = try container.decodeIfPresent(EditorFont.self, forKey: .font) ?? .init()
4343
self.enableTypeOverCompletion = try container.decodeIfPresent(
44-
Bool.self, forKey: .enableTypeOverCompletion) ?? true
45-
self.autocompleteBraces = try container.decodeIfPresent(Bool.self,
46-
forKey: .autocompleteBraces) ?? true
47-
self.wrapLinesToEditorWidth = try container.decodeIfPresent(Bool.self,
48-
forKey: .wrapLinesToEditorWidth) ?? true
49-
self.lineHeightMultiple = try container.decodeIfPresent(Double.self,
50-
forKey: .lineHeightMultiple) ?? 1.45
44+
Bool.self,
45+
forKey: .enableTypeOverCompletion
46+
) ?? true
47+
self.autocompleteBraces = try container.decodeIfPresent(
48+
Bool.self,
49+
forKey: .autocompleteBraces
50+
) ?? true
51+
self.wrapLinesToEditorWidth = try container.decodeIfPresent(
52+
Bool.self,
53+
forKey: .wrapLinesToEditorWidth
54+
) ?? true
55+
self.lineHeightMultiple = try container.decodeIfPresent(
56+
Double.self,
57+
forKey: .lineHeightMultiple
58+
) ?? 1.45
5159

5260
self.populateCommands()
5361
}
@@ -62,23 +70,26 @@ extension AppPreferences {
6270
id: "prefs.text_editing.type_over_completion",
6371
command: CommandClosureWrapper {
6472
AppPreferencesModel.shared.preferences.textEditing.enableTypeOverCompletion.toggle()
65-
})
73+
}
74+
)
6675

6776
mgr.addCommand(
6877
name: "Toggle Autocomplete Braces",
6978
title: "Toggle Autocomplete Braces",
7079
id: "prefs.text_editing.autocomplete_braces",
7180
command: CommandClosureWrapper {
7281
AppPreferencesModel.shared.preferences.textEditing.autocompleteBraces.toggle()
73-
})
82+
}
83+
)
7484

7585
mgr.addCommand(
7686
name: "Toggle Word Wrap",
7787
title: "Toggle Word Wrap",
7888
id: "prefs.text_editing.wrap_lines_to_editor_width",
7989
command: CommandClosureWrapper {
8090
AppPreferencesModel.shared.preferences.textEditing.wrapLinesToEditorWidth.toggle()
81-
})
91+
}
92+
)
8293
}
8394
}
8495

CodeEdit/Features/AppPreferences/Sections/AccountsPreferences/AccountPreferencesView.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ struct AccountPreferencesView: View {
4848
.foregroundColor(.secondary)
4949
.frame(maxWidth: .infinity, alignment: .leading)
5050
}
51-
List($prefs.preferences.accounts.sourceControlAccounts.gitAccount,
52-
selection: $accountSelection) { gitAccount in
51+
List(
52+
$prefs.preferences.accounts.sourceControlAccounts.gitAccount,
53+
selection: $accountSelection
54+
) { gitAccount in
5355
GitAccountItemView(sourceControlAccount: gitAccount)
5456
}
5557
.background(

CodeEdit/Features/AppPreferences/Sections/AccountsPreferences/Accounts/Login/Github/GitHubEnterpriseLoginView.swift

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ struct GitHubEnterpriseLoginView: View {
3939
}
4040
HStack {
4141
Text("Token:")
42-
SecureField("Enter your Personal Access Token",
43-
text: $accountToken)
42+
SecureField(
43+
"Enter your Personal Access Token",
44+
text: $accountToken
45+
)
4446
.frame(width: 300)
4547
}
4648
}
@@ -76,8 +78,10 @@ struct GitHubEnterpriseLoginView: View {
7678
private func loginGitHubEnterprise(gitAccountName: String) {
7779
let gitAccounts = prefs.preferences.accounts.sourceControlAccounts.gitAccount
7880

79-
let config = GitHubTokenConfiguration(accountToken,
80-
url: eneterpriseLink )
81+
let config = GitHubTokenConfiguration(
82+
accountToken,
83+
url: eneterpriseLink
84+
)
8185
GitHubAccount(config).me { response in
8286
switch response {
8387
case .success(let user):
@@ -86,14 +90,17 @@ struct GitHubEnterpriseLoginView: View {
8690
} else {
8791
print(user)
8892
prefs.preferences.accounts.sourceControlAccounts.gitAccount.append(
89-
SourceControlAccounts(id: gitAccountName.lowercased(),
90-
gitProvider: "GitHub",
91-
gitProviderLink: eneterpriseLink,
92-
gitProviderDescription: "GitHub",
93-
gitAccountName: gitAccountName,
94-
gitCloningProtocol: true,
95-
gitSSHKey: "",
96-
isTokenValid: true))
93+
SourceControlAccounts(
94+
id: gitAccountName.lowercased(),
95+
gitProvider: "GitHub",
96+
gitProviderLink: eneterpriseLink,
97+
gitProviderDescription: "GitHub",
98+
gitAccountName: gitAccountName,
99+
gitCloningProtocol: true,
100+
gitSSHKey: "",
101+
isTokenValid: true
102+
)
103+
)
97104
keychain.set(accountToken, forKey: "github_\(accountName)_enterprise")
98105
dismissDialog = false
99106
}

0 commit comments

Comments
 (0)