Skip to content

Commit

Permalink
Updated for 0.46.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklockwood committed Aug 28, 2020
1 parent adcb27e commit c8e7df8
Show file tree
Hide file tree
Showing 36 changed files with 63 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .swiftformat
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
--trimwhitespace always
--wraparguments preserve
--wrapcollections preserve
--specifierorder public,override
--modifierorder public,override

# rules

Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Change Log

## [0.46.0](https://github.com/nicklockwood/SwiftFormat/releases/tag/0.46.0) (2020-08-28)

- Added `organizeDeclarations` rule for grouping and organizing type members
- Added `wrapEnumCases` rule for wrapping enum cases onto separate lines
- Added `wrapSwitchCases` rule for wrapping switch cases onto separate lines
- Added `initCoderUnavailable` rule for marking stub `init(coder:)` implementations as unavailable
- Added `redundantType` rule for removing redundant type annotations from variable declarations
- Added search filter bar for rules in SwiftFormat for Xcode extension
- Selection is now preserved correctly in Xcode 12 when using SwiftFormat extension
- Fixed indenting of wrapped closure arguments when using `--closingparen same-line`
- Fixed spurious space insertion with `spaceAroundOperators` rule in some circumstances
- Switch cases marked with `@unknown` are now indented automatically instead of being ignored
- Wrapped method chains now behave more consistently when using `--xcodeindentation` option
- Removed deprecated `ranges` rule, but un-deprecated the `ranges` option for convenience
- Single-letter command-line flags now behave more usefully (e.g. -o maps to --output)
- Spaces are now permitted in comma-delimited command-line arguments
- Added more helpful feedback for mistyped arguments

## [0.45.6](https://github.com/nicklockwood/SwiftFormat/releases/tag/0.45.6) (2020-08-12)

- Added `--yodaswap` option for more fine-grained control of `yodaConditions` rule
Expand Down
Binary file modified CommandLineTool/swiftformat
Binary file not shown.
2 changes: 1 addition & 1 deletion EditorExtension/Extension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>0.45.6</string>
<string>0.46.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSMinimumSystemVersion</key>
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.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.45.6</string>
<string>0.46.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>0.45.6</string>
<string>0.46.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
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.
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@
</data>
<key>Resources/Assets.car</key>
<data>
qW3wFntmm4MSWnU/oirRU06qLvk=
U4/3np5ZtPpo66xXZoSjMU91mR4=
</data>
<key>Resources/Base.lproj/Main.storyboardc/9ZR-Qg-hHT-view-iDF-FY-6tf.nib</key>
<data>
Be6VnylSbBqb75WX8JXT668pgNg=
dzvBbru0m6gkU/bfxPuPnfQRS20=
</data>
<key>Resources/Base.lproj/Main.storyboardc/Info.plist</key>
<data>
NlbGVxngx33ffSLwx3xXD4RHK8s=
rIQIJ+UFAtVleeJmDuXZfcJw+EY=
</data>
<key>Resources/Base.lproj/Main.storyboardc/MainMenu.nib</key>
<data>
hFJfMbNOkYCI+j5764EGwWfzr2Q=
oogcd8puZ708EZURul3r5L6njuI=
</data>
<key>Resources/Base.lproj/Main.storyboardc/MainWindowTabViewController.nib</key>
<data>
fBoTvHLv87vmb1Fy2Li/43eukh8=
wshPSAgoJXua0n4X8yUp1jHKLnI=
</data>
<key>Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib</key>
<data>
aHKUKuof64bRqNNPoj3FITL/Pnc=
VzGwRdxswZCA4r5IaaGYQN8fyFA=
</data>
<key>Resources/Base.lproj/Main.storyboardc/RulesViewController.nib</key>
<data>
+eEt4CXweyhyrS46s68QGLX3H14=
C6eSL4OAikW8s5Uv3oz7/Mm0Qbc=
</data>
<key>Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib</key>
<data>
Expand Down Expand Up @@ -119,7 +119,7 @@
<dict>
<key>cdhash</key>
<data>
9VySy0GVbsivojpOUXpy81c2Kp8=
KRINOGvykWrQHjLhqkr4sBsVbg0=
</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>
Expand All @@ -139,77 +139,77 @@
<dict>
<key>hash</key>
<data>
qW3wFntmm4MSWnU/oirRU06qLvk=
U4/3np5ZtPpo66xXZoSjMU91mR4=
</data>
<key>hash2</key>
<data>
jx+G5jd2HJ03/2bMqKnBbA/TZEaQ/3iOe5n4obvlRn4=
1TfgC8gXg8tiRP33i6238P6YuyZpQUWgX/S1BIbS4/Y=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/9ZR-Qg-hHT-view-iDF-FY-6tf.nib</key>
<dict>
<key>hash</key>
<data>
Be6VnylSbBqb75WX8JXT668pgNg=
dzvBbru0m6gkU/bfxPuPnfQRS20=
</data>
<key>hash2</key>
<data>
CWrF2qfXqOeO+hzs3tv9FtZAfPpg2Q3ToyZIcBzaSn8=
IIGKEzUreAs2Ox7vijC3ZI2SK96pJlb7/DQSj2mUmLY=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/Info.plist</key>
<dict>
<key>hash</key>
<data>
NlbGVxngx33ffSLwx3xXD4RHK8s=
rIQIJ+UFAtVleeJmDuXZfcJw+EY=
</data>
<key>hash2</key>
<data>
seA3drxtIdmSg4ES+K1u6+gXdXHsPxk9jQ2tL4hOSCY=
UsCICT79lmtFdUJya4TrbWFXRn1XrIytUEIZ8Hndczo=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/MainMenu.nib</key>
<dict>
<key>hash</key>
<data>
hFJfMbNOkYCI+j5764EGwWfzr2Q=
oogcd8puZ708EZURul3r5L6njuI=
</data>
<key>hash2</key>
<data>
ssWgFuvVcTYGmsgutZctgp1KNP6vsZyYrWgQx7H2fio=
+kAHHbhkVMtDIQOl/T7G4Nh0k467xAfysFmJT4nzVkA=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/MainWindowTabViewController.nib</key>
<dict>
<key>hash</key>
<data>
fBoTvHLv87vmb1Fy2Li/43eukh8=
wshPSAgoJXua0n4X8yUp1jHKLnI=
</data>
<key>hash2</key>
<data>
pBB5lqzvOIk+pU5yTJo8LtlbHHSAmkuOMGI082xfLXY=
FVkvBKLqG3e4IjBg9kk3y0dffEIJXH+sZQkfAcE8K/I=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib</key>
<dict>
<key>hash</key>
<data>
aHKUKuof64bRqNNPoj3FITL/Pnc=
VzGwRdxswZCA4r5IaaGYQN8fyFA=
</data>
<key>hash2</key>
<data>
cv1J+MSCLe6hnDWLvz3eIVGzdw1X+63x3mhInpudabs=
uIu5lgebxXUyzXnc/5SEHbnIlsAhwoF/Q4AwDrdIZZA=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/RulesViewController.nib</key>
<dict>
<key>hash</key>
<data>
+eEt4CXweyhyrS46s68QGLX3H14=
C6eSL4OAikW8s5Uv3oz7/Mm0Qbc=
</data>
<key>hash2</key>
<data>
eootIDckv5GKPStNIQVTMpXypuTQHiTAbFHqww8xlaA=
lNz9Er6/arH1MmowpuycPwnhT9heUyTwRuLoub2d3GM=
</data>
</dict>
<key>Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib</key>
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -759,12 +759,13 @@ Credits
* [Tony Arnold](https://github.com/tonyarnold) - SwiftFormat for Xcode
* [Vincent Bernier](https://github.com/vinceburn) - SwiftFormat for Xcode settings UI
* [Vikram Kriplaney](https://github.com/markiv) - SwiftFormat for Xcode icon
* [Vikram Kriplaney](https://github.com/markiv) - SwiftFormat for Xcode icon and search feature
* [Hyperphonic](https://github.com/hyperphonic0) - Xcode 12 compatibility for SwiftFormat
* [Maxime Marinel](https://github.com/bourvill) - Git pre-commit hook script
* [Romain Pouclet](https://github.com/palleas) - Homebrew formula
* [Aerobounce](https://github.com/aerobounce) - Homebrew cask and Sublime Text plugin
* [Cal Stephens](https://github.com/calda) - Several formatting rules and options
* [Cal Stephens](https://github.com/calda) - Several new formatting rules and options
* [Facundo Menzella](https://github.com/acumenzella) - Several new formatting rules
* [Ali Akhtarzada](https://github.com/aliak00) - Several path-related CLI enhancements
* [Yonas Kolb](https://github.com/yonaskolb) - Swift Package Manager integration
* [Wolfgang Lutz](https://github.com/Lutzifer) - AppleScript integration instructions
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.45.6
// Version 0.46.0
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Nick Lockwood
Expand Down
2 changes: 1 addition & 1 deletion Sources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.45.6</string>
<string>0.46.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion Sources/Rules.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1833,7 +1833,7 @@ public struct _FormatRules {
guard let tag = ["TODO", "MARK", "FIXME"].first(where: { string.hasPrefix($0) }) else {
return
}
var suffix: String = String(string[tag.endIndex ..< string.endIndex])
var suffix = String(string[tag.endIndex ..< string.endIndex])
if let first = suffix.unicodeScalars.first, !" :".unicodeScalars.contains(first) {
// If not followed by a space or :, don't mess with it as it may be a custom format
return
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftFormat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import Foundation

/// The current SwiftFormat version
let swiftFormatVersion = "0.45.6"
let swiftFormatVersion = "0.46.0"
public let version = swiftFormatVersion

/// The standard SwiftFormat config file name
Expand Down
4 changes: 2 additions & 2 deletions Sources/Tokenizer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Tokenizer.swift
// SwiftFormat
//
// Version 0.45.6
// Version 0.46.0
//
// Created by Nick Lockwood on 11/08/2016.
// Copyright 2016 Nick Lockwood
Expand Down Expand Up @@ -1125,7 +1125,7 @@ public func tokenize(_ source: String) -> [Token] {
tokens[index] = .error(indent) // Mismatched whitespace
break
}
let remainder: String = String(indent[offset.endIndex ..< indent.endIndex])
let remainder = String(indent[offset.endIndex ..< indent.endIndex])
if case let .stringBody(body) = nextToken {
tokens[index + 1] = .stringBody(remainder + body)
} else if !remainder.isEmpty {
Expand Down
4 changes: 2 additions & 2 deletions SwiftFormat.podspec.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SwiftFormat",
"version": "0.45.6",
"version": "0.46.0",
"license": {
"type": "MIT",
"file": "LICENSE.md"
Expand All @@ -10,7 +10,7 @@
"authors": "Nick Lockwood",
"source": {
"git": "https://github.com/nicklockwood/SwiftFormat.git",
"tag": "0.45.6"
"tag": "0.46.0"
},
"default_subspecs": "Core",
"subspecs": [
Expand Down
4 changes: 2 additions & 2 deletions SwiftFormat.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@
INFOPLIST_FILE = EditorExtension/Application/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.11;
MARKETING_VERSION = 0.45.6;
MARKETING_VERSION = 0.46.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.SwiftFormat-for-Xcode";
PRODUCT_NAME = "SwiftFormat for Xcode";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -1215,7 +1215,7 @@
INFOPLIST_FILE = EditorExtension/Application/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.11;
MARKETING_VERSION = 0.45.6;
MARKETING_VERSION = 0.46.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.SwiftFormat-for-Xcode";
PRODUCT_NAME = "SwiftFormat for Xcode";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
2 changes: 1 addition & 1 deletion Tests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>0.45.6</string>
<string>0.46.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
8 changes: 5 additions & 3 deletions Tests/MetadataTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ class MetadataTests: XCTestCase {

func testAllRulesInRulesFile() {
for ruleName in FormatRules.byName.keys {
XCTAssertTrue(rulesFile.contains("## \(ruleName)"), "Rules.md does not contain \(ruleName) rule")
XCTAssertTrue(rulesFile.contains("## \(ruleName)"), """
Rules.md does not contain \(ruleName) rule (run MetadataTests again to fix)
""")
}
}

Expand All @@ -74,7 +76,7 @@ class MetadataTests: XCTestCase {
while let match = rulesFile.range(of: "\\*[a-zA-Z]+\\* - ", options: .regularExpression, range: range, locale: nil) {
let lower = rulesFile.index(after: match.lowerBound)
let upper = rulesFile.index(match.upperBound, offsetBy: -4)
let ruleName: String = String(rulesFile[lower ..< upper])
let ruleName = String(rulesFile[lower ..< upper])
XCTAssertTrue(ruleNames.contains(ruleName), ruleName)
range = match.upperBound ..< range.upperBound
}
Expand Down Expand Up @@ -190,7 +192,7 @@ class MetadataTests: XCTestCase {
while let match = rulesFile.range(of: "`--[a-zA-Z]+[` ]", options: .regularExpression, range: range, locale: nil) {
let lower = rulesFile.index(match.lowerBound, offsetBy: 3)
let upper = rulesFile.index(before: match.upperBound)
let argument: String = String(rulesFile[lower ..< upper])
let argument = String(rulesFile[lower ..< upper])
XCTAssertTrue(arguments.contains(argument), argument)
range = match.upperBound ..< range.upperBound
}
Expand Down

0 comments on commit c8e7df8

Please sign in to comment.