From 32792b2485a36631a6181adb7a7d13f948440a80 Mon Sep 17 00:00:00 2001 From: Rakuyo Date: Mon, 15 Jul 2024 16:39:31 +0800 Subject: [PATCH 1/3] chore: Update SwiftFormat to 0.54.1 --- Package.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Package.swift b/Package.swift index e7f0b54..3ed2ddf 100644 --- a/Package.swift +++ b/Package.swift @@ -47,8 +47,8 @@ let package = Package( .binaryTarget( name: "SwiftFormat", - url: "https://github.com/nicklockwood/SwiftFormat/releases/download/0.54.0/SwiftFormat.artifactbundle.zip", - checksum: "edf4ed2f1664ad621ae71031ff915e0c6ef80ad66e87ea0e5a10c3580a27a6dd" + url: "https://github.com/nicklockwood/SwiftFormat/releases/download/0.54.1/SwiftFormat.artifactbundle.zip", + checksum: "ceabca9e43b3d94f8005a48744e6a1ca4006daa43ff8349808469a584ed88ef5" ), .binaryTarget( From 46083fca735666e0f4c1fbd6bba7fb2a91e1a792 Mon Sep 17 00:00:00 2001 From: Rakuyo Date: Mon, 15 Jul 2024 16:39:51 +0800 Subject: [PATCH 2/3] feat: SwiftFormat rules add `redundantNilInit ` --- Sources/RakuyoSwiftFormatTool/rakuyo.swiftformat | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/RakuyoSwiftFormatTool/rakuyo.swiftformat b/Sources/RakuyoSwiftFormatTool/rakuyo.swiftformat index 59a09d4..a241818 100644 --- a/Sources/RakuyoSwiftFormatTool/rakuyo.swiftformat +++ b/Sources/RakuyoSwiftFormatTool/rakuyo.swiftformat @@ -36,6 +36,7 @@ --shortoptionals always # typeSugar --semicolons never # semicolons --doccomments preserve # docComments +--nilInit insert # redundantNilInit # We recommend a max width of 100 but _strictly enforce_ a max width of 130 --maxwidth 130 # wrap @@ -108,3 +109,4 @@ --rules redundantTypedThrows --rules consistentSwitchCaseSpacing --rules blankLineAfterSwitchCase +--rules redundantNilInit From 7a61c1fd23c45343357d88bba461cab50b30ea92 Mon Sep 17 00:00:00 2001 From: Rakuyo Date: Mon, 15 Jul 2024 16:40:50 +0800 Subject: [PATCH 3/3] style: Update --- .../RakuyoSwiftFormatToolTests.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/RakuyoSwiftFormatToolTests/RakuyoSwiftFormatToolTests.swift b/Tests/RakuyoSwiftFormatToolTests/RakuyoSwiftFormatToolTests.swift index 716f8ae..e3e22c8 100644 --- a/Tests/RakuyoSwiftFormatToolTests/RakuyoSwiftFormatToolTests.swift +++ b/Tests/RakuyoSwiftFormatToolTests/RakuyoSwiftFormatToolTests.swift @@ -273,9 +273,9 @@ extension RakuyoSwiftFormatToolTest { /// Mock implementations of the commands ran by `RakuyoSwiftFormatTool` struct MockCommands { - var swiftFormat: (() -> Int32)? - var swiftLint: (() -> Int32)? - var swiftLintAutocorrect: (() -> Int32)? + var swiftFormat: (() -> Int32)? = nil + var swiftLint: (() -> Int32)? = nil + var swiftLintAutocorrect: (() -> Int32)? = nil func mockRunCommand(_ command: Command) -> Int32 { if command.launchPath.lowercased().contains("swiftformat") {