Skip to content

Commit

Permalink
Updated for 0.45.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklockwood committed Jul 30, 2020
1 parent b330357 commit 1e55436
Show file tree
Hide file tree
Showing 28 changed files with 52 additions and 27 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## [0.45.1](https://github.com/nicklockwood/SwiftFormat/releases/tag/0.45.1) (2020-07-30)

- Fixed bug where `preferKeyPath` was incorrectly applied to function calls and compound expressions
- The `wrapMultilineStatementBraces` rule is now applied to `init` and `subscript` braces
- The `wrapAttributes` rule now handles `init` and `subscript` the same way as functions

## [0.45.0](https://github.com/nicklockwood/SwiftFormat/releases/tag/0.45.0) (2020-07-29)

- Added `wrapAttributes` rule for controlling attribute position
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.0</string>
<string>0.45.1</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSMinimumSystemVersion</key>
Expand Down
4 changes: 2 additions & 2 deletions EditorExtension/SwiftFormat for Xcode.app/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.45.0</string>
<string>0.45.1</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>2</string>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
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.0</string>
<string>0.45.1</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
<dict>
<key>cdhash</key>
<data>
yqBXZ9u1Abh1i3rpdut+YHxtCI4=
H1noZw94n2HZjiZgaGZ51xxt7ts=
</data>
<key>requirement</key>
<string>anchor apple generic and identifier "com.apple.dt.XcodeKit" 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>
<string>identifier "com.apple.dt.XcodeKit" and anchor apple generic and certificate leaf[subject.CN] = "Apple Development: Nick Lockwood (XDQ4XJZXHD)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */</string>
</dict>
</dict>
<key>rules</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.
5 changes: 3 additions & 2 deletions 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.0
// Version 0.45.1
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Nick Lockwood
Expand Down Expand Up @@ -109,7 +109,8 @@ public class Formatter: NSObject {

/// Create a new formatter instance from a token array
public init(_ tokens: [Token], options: FormatOptions = FormatOptions(),
trackChanges: Bool = false, range: Range<Int>? = nil) {
trackChanges: Bool = false, range: Range<Int>? = nil)
{
self.tokens = tokens
self.options = options
self.trackChanges = trackChanges
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.0</string>
<string>0.45.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
9 changes: 6 additions & 3 deletions Sources/Options.swift
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,8 @@ public struct FormatOptions: CustomStringConvertible {
fragment: Bool = false,
ignoreConflictMarkers: Bool = false,
swiftVersion: Version = .undefined,
fileInfo: FileInfo = FileInfo()) {
fileInfo: FileInfo = FileInfo())
{
self.indent = indent
self.linebreak = linebreak
self.allowInlineSemicolons = allowInlineSemicolons
Expand Down Expand Up @@ -451,7 +452,8 @@ public struct FileOptions {
supportedFileExtensions: [String] = ["swift"],
excludedGlobs: [Glob] = [],
unexcludedGlobs: [Glob] = [],
minVersion: Version = .undefined) {
minVersion: Version = .undefined)
{
self.followSymlinks = followSymlinks
self.supportedFileExtensions = supportedFileExtensions
self.excludedGlobs = excludedGlobs
Expand All @@ -474,7 +476,8 @@ public struct Options {

public init(fileOptions: FileOptions? = nil,
formatOptions: FormatOptions? = nil,
rules: Set<String>? = nil) {
rules: Set<String>? = nil)
{
self.fileOptions = fileOptions
self.formatOptions = formatOptions
self.rules = rules
Expand Down
21 changes: 14 additions & 7 deletions Sources/OptionsDescriptor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ extension FormatOptions {
help: String,
keyPath: WritableKeyPath<FormatOptions, Bool>,
trueValues: [String],
falseValues: [String]) {
falseValues: [String])
{
assert(argumentName.count <= Options.maxArgumentNameLength)
self.argumentName = argumentName
self.propertyName = propertyName
Expand Down Expand Up @@ -114,7 +115,8 @@ extension FormatOptions {
help: String,
keyPath: WritableKeyPath<FormatOptions, T>,
fromArgument: @escaping (String) -> T?,
toArgument: @escaping (T) -> String) {
toArgument: @escaping (T) -> String)
{
self.argumentName = argumentName
self.propertyName = propertyName
self.displayName = displayName
Expand All @@ -136,7 +138,8 @@ extension FormatOptions {
displayName: String,
help: String,
keyPath: WritableKeyPath<FormatOptions, String>,
options: DictionaryLiteral<String, String>) {
options: DictionaryLiteral<String, String>)
{
let map: [String: String] = Dictionary(options.map { ($0, $1) }, uniquingKeysWith: { $1 })
let keys = Array(map.keys)
self.init(argumentName: argumentName,
Expand All @@ -162,7 +165,8 @@ extension FormatOptions {
propertyName: String,
displayName: String,
help: String = "",
keyPath: WritableKeyPath<FormatOptions, T>) where T.RawValue == String {
keyPath: WritableKeyPath<FormatOptions, T>) where T.RawValue == String
{
self.argumentName = argumentName
self.propertyName = propertyName
self.displayName = displayName
Expand All @@ -184,7 +188,8 @@ extension FormatOptions {
displayName: String,
help: String = "",
keyPath: WritableKeyPath<FormatOptions, T>,
options: [String]) where T.RawValue == String {
options: [String]) where T.RawValue == String
{
self.init(
argumentName: argumentName,
propertyName: propertyName,
Expand All @@ -200,7 +205,8 @@ extension FormatOptions {
displayName: String,
help: String,
keyPath: WritableKeyPath<FormatOptions, [String]>,
validate: @escaping (String) throws -> Void = { _ in }) {
validate: @escaping (String) throws -> Void = { _ in })
{
self.argumentName = argumentName
self.propertyName = propertyName
self.displayName = displayName
Expand All @@ -226,7 +232,8 @@ extension FormatOptions {
displayName: String,
help: String,
keyPath: WritableKeyPath<FormatOptions, Set<String>>,
validate: @escaping (String) throws -> Void = { _ in }) {
validate: @escaping (String) throws -> Void = { _ in })
{
self.argumentName = argumentName
self.propertyName = propertyName
self.displayName = displayName
Expand Down
3 changes: 2 additions & 1 deletion Sources/Rules.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public final class FormatRule: Equatable, Comparable {
orderAfter: [String] = [],
options: [String] = [],
sharedOptions: [String] = [],
_ fn: @escaping (Formatter) -> Void) {
_ fn: @escaping (Formatter) -> Void)
{
self.fn = fn
self.help = help
self.orderAfter = orderAfter
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.0"
let swiftFormatVersion = "0.45.1"
public let version = swiftFormatVersion

/// The standard SwiftFormat config file name
Expand Down
2 changes: 1 addition & 1 deletion 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.0
// Version 0.45.1
//
// Created by Nick Lockwood on 11/08/2016.
// Copyright 2016 Nick Lockwood
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.0",
"version": "0.45.1",
"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.0"
"tag": "0.45.1"
},
"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 @@ -1178,7 +1178,7 @@
INFOPLIST_FILE = EditorExtension/Application/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.11;
MARKETING_VERSION = 0.45.0;
MARKETING_VERSION = 0.45.1;
PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.SwiftFormat-for-Xcode";
PRODUCT_NAME = "SwiftFormat for Xcode";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -1205,7 +1205,7 @@
INFOPLIST_FILE = EditorExtension/Application/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.11;
MARKETING_VERSION = 0.45.0;
MARKETING_VERSION = 0.45.1;
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.0</string>
<string>0.45.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
6 changes: 6 additions & 0 deletions Tests/RulesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12409,4 +12409,10 @@ class RulesTests: XCTestCase {
let options = FormatOptions(swiftVersion: "5.2")
testFormatting(for: input, rule: FormatRules.preferKeyPath, options: options)
}

func testNoMapPropertyToKeyPathForOptionalChaining() {
let input = "let foo = bar.map { $0?.foo }"
let options = FormatOptions(swiftVersion: "5.2")
testFormatting(for: input, rule: FormatRules.preferKeyPath, options: options)
}
}
1 change: 1 addition & 0 deletions Tests/XCTestManifests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,7 @@ extension RulesTests {
("testNoMangleYodaConditionInTernary3", testNoMangleYodaConditionInTernary3),
("testNoMapPropertyToKeyPathForCompoundExpressions", testNoMapPropertyToKeyPathForCompoundExpressions),
("testNoMapPropertyToKeyPathForFunctionCalls", testNoMapPropertyToKeyPathForFunctionCalls),
("testNoMapPropertyToKeyPathForOptionalChaining", testNoMapPropertyToKeyPathForOptionalChaining),
("testNoMapPropertyToKeyPathForSwiftLessThan5_2", testNoMapPropertyToKeyPathForSwiftLessThan5_2),
("testNoMapSelfToKeyPath", testNoMapSelfToKeyPath),
("testNoMarkFunctionArgument", testNoMarkFunctionArgument),
Expand Down

0 comments on commit 1e55436

Please sign in to comment.