Skip to content

Commit ca2de7c

Browse files
committed
Add new rules to project .swiftformat file
1 parent f420383 commit ca2de7c

File tree

164 files changed

+333
-324
lines changed

Some content is hidden

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

164 files changed

+333
-324
lines changed

.swiftformat

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,16 @@
3737

3838
# rules
3939

40+
--enable unusedPrivateDeclarations
41+
--enable emptyExtensions
4042
--enable isEmpty
43+
--enable docComments
44+
# --enable noForceTryInTests
45+
# --enable noForceUnwrapInTests
46+
# --enable noGuardInTests
47+
--enable preferFinalClasses
48+
--enable redundantAsync
49+
--enable redundantEquatable
50+
--enable redundantMemberwiseInit
51+
--enable redundantProperty
52+
--enable redundantThrows

EditorExtension/Application/Source/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import Cocoa
3333

3434
@main
35-
class AppDelegate: NSObject, NSApplicationDelegate {
35+
final class AppDelegate: NSObject, NSApplicationDelegate {
3636
var window: NSWindow? {
3737
NSApp.mainWindow
3838
}

EditorExtension/Application/Source/FreeTextTableCellView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
import Cocoa
3333

34-
class FreeTextTableCellView: NSTableCellView {
34+
final class FreeTextTableCellView: NSTableCellView {
3535
@IBOutlet var title: NSTextField!
3636
@IBOutlet var freeTextField: NSTextField!
3737

EditorExtension/Application/Source/ListSelectionTableCellView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
import Cocoa
3333

34-
class ListSelectionTableCellView: NSTableCellView {
34+
final class ListSelectionTableCellView: NSTableCellView {
3535
@IBOutlet var title: NSTextField!
3636
@IBOutlet var dropDown: NSPopUpButton!
3737
@IBAction func listSelectionChanged(_: NSPopUpButton) {

EditorExtension/Extension/FormatFileCommand.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import Foundation
3333
import XcodeKit
3434

35-
class FormatFileCommand: NSObject, XCSourceEditorCommand {
35+
final class FormatFileCommand: NSObject, XCSourceEditorCommand {
3636
func perform(with invocation: XCSourceEditorCommandInvocation, completionHandler: @escaping (Error?) -> Void) {
3737
guard SupportedContentUTIs.contains(invocation.buffer.contentUTI) else {
3838
return completionHandler(FormatCommandError.notSwiftLanguage)

EditorExtension/Extension/FormatSelectionCommand.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import Foundation
3333
import XcodeKit
3434

35-
class FormatSelectionCommand: NSObject, XCSourceEditorCommand {
35+
final class FormatSelectionCommand: NSObject, XCSourceEditorCommand {
3636
func perform(with invocation: XCSourceEditorCommandInvocation, completionHandler: @escaping (Error?) -> Void) {
3737
guard SupportedContentUTIs.contains(invocation.buffer.contentUTI) else {
3838
return completionHandler(FormatCommandError.notSwiftLanguage)

EditorExtension/Extension/LintFileCommand.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import Foundation
1010
import XcodeKit
1111

12-
class LintFileCommand: NSObject, XCSourceEditorCommand {
12+
final class LintFileCommand: NSObject, XCSourceEditorCommand {
1313
func perform(with invocation: XCSourceEditorCommandInvocation, completionHandler: @escaping (Error?) -> Void) {
1414
guard SupportedContentUTIs.contains(invocation.buffer.contentUTI) else {
1515
return completionHandler(FormatCommandError.notSwiftLanguage)

EditorExtension/Extension/SourceEditorExtension.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@
3232
import Foundation
3333
import XcodeKit
3434

35-
class SourceEditorExtension: NSObject, XCSourceEditorExtension {}
35+
final class SourceEditorExtension: NSObject, XCSourceEditorExtension {}

PerformanceTests/PerformanceTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ private let rulesDirectory = URL(fileURLWithPath: #file)
3636
.deletingLastPathComponent().deletingLastPathComponent()
3737
.appendingPathComponent("Sources/Rules")
3838

39-
class PerformanceTests: XCTestCase {
39+
final class PerformanceTests: XCTestCase {
4040
static let files: [String] = {
4141
var files = [String]()
4242
_ = enumerateFiles(withInputURL: rulesDirectory) { url, _, _ in

Plugins/SwiftFormatPlugin/SwiftFormatPlugin.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,8 @@ import PackagePlugin
7070
.map { (key: $0.element, value: $0.offset) }
7171
let indexLookupTable = Dictionary(enumeratedKeyValues, uniquingKeysWith: { l, _ in l })
7272
let groupedByID = Dictionary(grouping: withLocalDependencies, by: \.id)
73-
let sortedUniqueTargets = groupedByID.map(\.value[0])
73+
return groupedByID.map(\.value[0])
7474
.sorted { indexLookupTable[$0.id, default: 0] < indexLookupTable[$1.id, default: 0] }
75-
return sortedUniqueTargets
7675
}
7776
}
7877
#endif

0 commit comments

Comments
 (0)