Skip to content

Commit

Permalink
Update for 0.47.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklockwood committed Oct 14, 2020
1 parent f319b91 commit 1f96916
Show file tree
Hide file tree
Showing 50 changed files with 564 additions and 584 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Change Log

## [0.47.0](https://github.com/nicklockwood/SwiftFormat/releases/tag/0.47.0) (2020-10-14)

- Indenting of wrapped `if`, `guard`, `while`, etc. now matches Xcode 12 behavior
- Added `--assetliterals` option for managing how image/color literal length is handled
- Added `enumNamespaces` rule to replace classes/structs that only have static members with an enum
- Added `extensionAccessControl` rule to hoist/unhoist access control modifiers inside extensions
- Added `markTypes` rule for automatically inserting `MARK:` comments between type declarations
- Added `sortedSwitchCases` rule to automatically sort grouped switch cases alphabetically
- Added ``--wrapreturntype` option to control how return type is wrapped in function declarations
- The `organizeDeclarations` rule is now also applied to extensions
- Updated `--xcodeindentation` behavior for Xcode 12

## [0.46.3](https://github.com/nicklockwood/SwiftFormat/releases/tag/0.46.3) (2020-09-20)

- Fixed bug where `redundantType` rule corrupted assignments involving ternary expressions
Expand Down
Binary file modified CommandLineTool/swiftformat
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class FreeTextTableCellView: NSTableCellView {
extension FreeTextTableCellView: NSTextFieldDelegate {
override func controlTextDidChange(_ obj: Notification) {
guard let textView: NSTextView = obj.userInfo!["NSFieldEditor"] as? NSTextView,
let freeText = objectValue as? UserSelectionFreeText
let freeText = objectValue as? UserSelectionFreeText
else {
return
}
Expand Down
8 changes: 4 additions & 4 deletions EditorExtension/Shared/OptionsStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ struct SavedOption {
}
}

extension SavedOption {
fileprivate init(_ rep: OptionsStore.OptionRepresentation) throws {
private extension SavedOption {
init(_ rep: OptionsStore.OptionRepresentation) throws {
guard let descriptor = Descriptors.byName[rep.id] else {
throw FormatError.options("Unknown option \(rep.id)")
}
Expand All @@ -53,8 +53,8 @@ extension SavedOption {
}
}

extension FormatOptions {
fileprivate init(_ rep: OptionsStore.OptionStoreRepresentation) throws {
private extension FormatOptions {
init(_ rep: OptionsStore.OptionStoreRepresentation) throws {
var formatOptions = FormatOptions.default
for descriptor in Descriptors.all.reversed() {
// By loading formatting options in reverse, we ensure that
Expand Down
4 changes: 2 additions & 2 deletions EditorExtension/Shared/RulesStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ extension Rule: Comparable {
}
}

extension Rule {
fileprivate init(_ ruleRep: (String, Bool)) {
private extension Rule {
init(_ ruleRep: (String, Bool)) {
self.init(name: ruleRep.0, isEnabled: ruleRep.1)
}
}
Expand Down
Binary file modified EditorExtension/SwiftFormat for Xcode.app/Contents/CodeResources
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions EditorExtension/SwiftFormat for Xcode.app/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>19G2021</string>
<string>19H2</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDocumentTypes</key>
Expand Down Expand Up @@ -36,7 +36,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.46.3</string>
<string>0.47.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
Expand All @@ -62,7 +62,7 @@
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
<string>10.11</string>
<string>10.14</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2016 Nick Lockwood. All rights reserved.</string>
<key>NSMainStoryboardFile</key>
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>19G2021</string>
<string>19H2</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
Expand Down Expand Up @@ -41,7 +41,7 @@
<key>DTXcodeBuild</key>
<string>12A7209</string>
<key>LSMinimumSystemVersion</key>
<string>10.11</string>
<string>10.14</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,35 @@
<dict>
<key>Resources/AppIcon.icns</key>
<data>
IsifGQ6u46Cp81IAOcJIcLkuxGw=
49ta0JaEQzFhN907kv6SiH1kchU=
</data>
<key>Resources/Assets.car</key>
<data>
DQYLd/jkRuxSrE6Ok/kK1WIbH3c=
YiheLpyp+SRLXxFU721UYx8oI6c=
</data>
<key>Resources/Base.lproj/Main.storyboardc/9ZR-Qg-hHT-view-iDF-FY-6tf.nib</key>
<data>
PJwNXgb4aiLkgOZKY5pNFVMSGPI=
NgkuD0ekbF0F8PCXGo2XyDdQEZ4=
</data>
<key>Resources/Base.lproj/Main.storyboardc/Info.plist</key>
<data>
BMnGqn+yx3vG3HhgYj1L+IMJwXE=
+/DJ7okKXSwZ02uqruRsLmLrVME=
</data>
<key>Resources/Base.lproj/Main.storyboardc/MainMenu.nib</key>
<data>
0z5SQhAJml+mZe/49kSf+ItZEEw=
lI7KbQws4PaWE18pL0llqYlccT0=
</data>
<key>Resources/Base.lproj/Main.storyboardc/MainWindowTabViewController.nib</key>
<data>
yUeufolLhKGDGDqfc5SVyDRHM2s=
sWeCbAsRLvNYKtIy6w6ivu/7Qpk=
</data>
<key>Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib</key>
<data>
LIEBJbRA6qayOSDiWRqj5U0u4gI=
Zdo9GV43c2YGAWk8LB9vj4kOsAg=
</data>
<key>Resources/Base.lproj/Main.storyboardc/RulesViewController.nib</key>
<data>
rfAECe1mswYnskltpW21hKH6NEU=
beYTI7gNKts02jpMY7lcElpKxsk=
</data>
<key>Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib</key>
<data>
Expand Down Expand Up @@ -182,105 +182,69 @@
<dict>
<key>cdhash</key>
<data>
kToM7834srzzv6TNZRRMlyNBEJY=
Z+z+6QsyriEW62UtZKRx4w/hNm8=
</data>
<key>requirement</key>
<string>anchor apple generic and identifier "com.charcoaldesign.SwiftFormat-for-Xcode.SourceEditorExtension" and (certificate leaf[field.1.2.840.113635.100.6.1.9] /* exists */ or certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = "8VQKF583ED")</string>
</dict>
<key>Resources/AppIcon.icns</key>
<dict>
<key>hash</key>
<data>
IsifGQ6u46Cp81IAOcJIcLkuxGw=
</data>
<key>hash2</key>
<data>
HhzZtyg6k6342A4NxIR25LPdwke/QvBhXVxaZPTv/yo=
uL7GZda4f/Vm3xjeFMdkmr5AHvnjhcJFkLlXkF6xsf4=
</data>
</dict>
<key>Resources/Assets.car</key>
<dict>
<key>hash</key>
<data>
DQYLd/jkRuxSrE6Ok/kK1WIbH3c=
</data>
<key>hash2</key>
<data>
FhMDp6Rp6kAYwyARB6RKT01iGzwDEcGs5vR1R9duSdI=
GYXZ11g7/0ggejEJ1zVPKm8+O+vtpstht2WvFXURoag=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/9ZR-Qg-hHT-view-iDF-FY-6tf.nib</key>
<dict>
<key>hash</key>
<data>
PJwNXgb4aiLkgOZKY5pNFVMSGPI=
</data>
<key>hash2</key>
<data>
RyofvGzD02vsmP570BUBJf3H2iKlskFLkNM2Yqiz5iE=
SFlU7n9v5kte+wKrebcdyk34TT5YjcOgi20SozeVsAE=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/Info.plist</key>
<dict>
<key>hash</key>
<data>
BMnGqn+yx3vG3HhgYj1L+IMJwXE=
</data>
<key>hash2</key>
<data>
mfZctbb5otaIASUXlSGMkw6F/3XSJvLj7h838758854=
or34ef1CtY0IAqy8rCQrmLYSv5sn6jdShMx4sLw+9s4=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/MainMenu.nib</key>
<dict>
<key>hash</key>
<data>
0z5SQhAJml+mZe/49kSf+ItZEEw=
</data>
<key>hash2</key>
<data>
I0QWL2U6Mi/KJrb8xHWabsuuba7PjN4HXmlXIgFZdIU=
qrLtyVyZiN2qpsNs1XdrvF9DrmXStoXqUyrcRkYL+WQ=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/MainWindowTabViewController.nib</key>
<dict>
<key>hash</key>
<data>
yUeufolLhKGDGDqfc5SVyDRHM2s=
</data>
<key>hash2</key>
<data>
O5MH3wMtEvTuxPNzVokAZkPqJ622y8tIqvKzGQFwBvM=
0niOKWSTJYKDJD/YK454D67ykqdcOV63t7geVMDXWcg=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib</key>
<dict>
<key>hash</key>
<data>
LIEBJbRA6qayOSDiWRqj5U0u4gI=
</data>
<key>hash2</key>
<data>
69SnBbVIaXKwhMt6LtIIXP6vk0ZxA4x9hx3kTVT9RYU=
22rpMYPNyrK/2QRHNpkFjy8pphfvIWoc+SmS6USZBB4=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/RulesViewController.nib</key>
<dict>
<key>hash</key>
<data>
rfAECe1mswYnskltpW21hKH6NEU=
</data>
<key>hash2</key>
<data>
4qql7sNGICUVfrzSrHX9eiNz8k8XkuAPGmpLI2LN2Ck=
LsMenOnAUxX3uVz8bsmLY81eVMjvyPE5PJrkBheicG0=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib</key>
<dict>
<key>hash</key>
<data>
9QDdTtGXlGK6L/lwYL92eAU0kMk=
</data>
<key>hash2</key>
<data>
8/fmpfJkFkrcEOjAXPJGkiexY7vP8bksKSro2h6+1O0=
Expand Down
16 changes: 8 additions & 8 deletions Sources/Arguments.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ func preprocessArguments(_ args: [String], _ names: [String]) throws -> [String:
arg = String(arg.dropLast())
}
if let existing = namedArgs[name], !existing.isEmpty,
// TODO: find a more general way to represent merge-able options
["exclude", "unexclude", "disable", "enable", "rules"].contains(name) ||
Descriptors.all.contains(where: {
$0.argumentName == name && $0.isSetType
})
// TODO: find a more general way to represent merge-able options
["exclude", "unexclude", "disable", "enable", "rules"].contains(name) ||
Descriptors.all.contains(where: {
$0.argumentName == name && $0.isSetType
})
{
namedArgs[name] = existing + "," + arg
} else {
Expand Down Expand Up @@ -250,14 +250,14 @@ func mergeArguments(_ args: [String: String], into config: [String: String]) thr
var output = args
// Merge excluded urls
if let exclude = output["exclude"].map(parseCommaDelimitedList),
var excluded = input["exclude"].map({ Set(parseCommaDelimitedList($0)) })
var excluded = input["exclude"].map({ Set(parseCommaDelimitedList($0)) })
{
excluded.formUnion(exclude)
output["exclude"] = Array(excluded).sorted().joined(separator: ",")
}
// Merge unexcluded urls
if let unexclude = output["unexclude"].map(parseCommaDelimitedList),
var unexcluded = input["unexclude"].map({ Set(parseCommaDelimitedList($0)) })
var unexcluded = input["unexclude"].map({ Set(parseCommaDelimitedList($0)) })
{
unexcluded.formUnion(unexclude)
output["unexclude"] = Array(unexcluded).sorted().joined(separator: ",")
Expand Down Expand Up @@ -443,7 +443,7 @@ func argumentsFor(_ options: Options, excludingDefaults: Bool = false) -> [Strin
// Special case for swiftVersion
// TODO: find a better solution for this
if descriptor.argumentName == Descriptors.swiftVersion.argumentName,
value == Version.undefined.rawValue
value == Version.undefined.rawValue
{
continue
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/CommandLine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,8 @@ func processArguments(_ args: [String], in directory: String) -> ExitCode {
$0.trimmingCharacters(in: .whitespacesAndNewlines)
}
guard (1 ... 2).contains(parts.count),
let start = parts.first.flatMap(Int.init),
let end = parts.last.flatMap(Int.init)
let start = parts.first.flatMap(Int.init),
let end = parts.last.flatMap(Int.init)
else {
throw FormatError.options("Unsupported --linerange value '\(arg)'")
}
Expand Down Expand Up @@ -1013,7 +1013,7 @@ func processInput(_ inputURLs: [URL],
}
// Save cache
if outputFlags.filesChecked > 0, let cache = cache, let cacheURL = cacheURL,
let cacheDirectory = cacheDirectory
let cacheDirectory = cacheDirectory
{
do {
let data = try JSONEncoder().encode(cache)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Formatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Formatter.swift
// SwiftFormat
//
// Version 0.46.3
// Version 0.47.0
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Nick Lockwood
Expand Down
Loading

0 comments on commit 1f96916

Please sign in to comment.