Skip to content

Commit

Permalink
Update for 0.54.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklockwood committed Jun 11, 2024
1 parent f22e0ef commit dd989a4
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 32 deletions.
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
# Change Log

## [0.54.0](https://github.com/nicklockwood/SwiftFormat/releases/tag/0.54.0) (2024-06-11)

- Added `blankLineAfterSwitchCase` rule for inserting blank lines after switch cases
- Added `consistentSwitchCaseSpacing` rule for ensuring consistent spacing between switch cases
- Added `redundantProperty` rule for removing variable assignments where value is immediately returned
- Added `redundantTypedThrows` rule for stripping redundant `Never` or `any Error` `throws` types
- Setting `--report` without `--reporter` type now raises an error if type can't be inferred
- Added XML reporter for Checkstyle-compatible lint reporting (use the `--reporter xml` option)
- Added `--typedelimiter` option for controlling spacing around the colon in type definitions
- Added `--initcodernil` option for returning `nil` instead of asserting in unavailable `init?(coder:)`
- The `fileHeader` rule now uses git info for `created` date (if available) instead of file system
- Added git `author`, `author.name` and `author.email` tokens for file header templates
- Added `--callsiteparen` option for controlling closing paren placement at function call sites
- The `wrapAttributes` rule can now be applied differently to computed properties vs stored properties
- The `wrapAttributes` rule can now be applied differently to complex (parameterized) vs simple attributes
- Replaced `--varattributes` with `--storedvarattrs`, `--computedvarattrs` and `--complexattrs` options
- Added `—-nilinit` option for controlling whether `redundantNilInit` adds or removes explicit `nil`
- Added ability to organize declarations by type over visibility (use `--organizationmode type`)
- Fixed bug where enabling `organizeDeclarations` for structs caused `sortDeclarations` to have no effect
- Fixed bug where if statement body could be incorrectly parsed as a trailing closure
- Improved attribute handling in `opaqueGenericParameters rule`
- SwiftFormat now recognizes `init` and `_modify` property accessors
- Fixed bug with `preferForLoop` rule and tuple argument matching
- Extended `conditionalAssignment` rule to handle more cases
- Added `--condassignment after-property` option
- Fixed await being hoisted outside of macro arguments
- Fixed unsafe adding/removal of `self` within macros
- Added `os_log` to `--selfrequired` defaults

## [0.53.10](https://github.com/nicklockwood/SwiftFormat/releases/tag/0.53.10) (2024-05-18)

- Fixed creation of spurious `stdout` directory when using `--output stdout`
Expand Down
Binary file modified CommandLineTool/swiftformat
Binary file not shown.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ let package = Package(
name: "BuildTools",
platforms: [.macOS(.v10_11)],
dependencies: [
.package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.53.9"),
.package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.54.0"),
],
targets: [.target(name: "BuildTools", path: "")]
)
Expand Down Expand Up @@ -286,7 +286,7 @@ You can also use `swift run -c release --package-path BuildTools swiftformat "$S
1. Add the `swiftformat` binary to your project directory via [CocoaPods](https://cocoapods.org/), by adding the following line to your Podfile then running `pod install`:

```ruby
pod 'SwiftFormat/CLI', '~> 0.49'
pod 'SwiftFormat/CLI', '~> 0.54'
```

**NOTE:** This will only install the pre-built command-line app, not the source code for the SwiftFormat framework.
Expand Down Expand Up @@ -354,7 +354,7 @@ You can use `SwiftFormat` as a SwiftPM command plugin.
```swift
dependencies: [
// ...
.package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.53.9"),
.package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.54.0"),
]
```

Expand Down Expand Up @@ -965,14 +965,14 @@ SwiftFormat is not a commercially-funded product, it's a labor of love given fre
Credits
------------

* [Cal Stephens](https://github.com/calda) - Numerous new formatting rules, options and bug fixes
* [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 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 new formatting rules and options
* [Facundo Menzella](https://github.com/facumenzella) - Several new formatting rules and options
* [Ali Akhtarzada](https://github.com/aliak00) - Several path-related CLI enhancements
* [Yonas Kolb](https://github.com/yonaskolb) - Swift Package Manager integration
Expand All @@ -989,6 +989,7 @@ Credits
* [Saleem Abdulrasool](https://github.com/compnerd) - Windows build workflow
* [Arthur Semenyutin](https://github.com/vox-humana) - Docker image
* [Marco Eidinger](https://github.com/MarcoEidinger) - Swift Package Manager plugin
* [Hampus Tågerud](https://github.com/hampustagerud) - Git integration for fileHeader rule
* [Nick Lockwood](https://github.com/nicklockwood) - Everything else

([Full list of contributors](https://github.com/nicklockwood/SwiftFormat/graphs/contributors))
42 changes: 23 additions & 19 deletions Sources/GitFileInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,32 +62,36 @@ extension GitFileInfo {

private extension String {
func shellOutput(cwd: URL? = nil) -> String? {
let process = Process()
let pipe = Pipe()
#if os(macOS) || os(Linux) || os(Windows)
let process = Process()
let pipe = Pipe()

process.executableURL = URL(fileURLWithPath: "/bin/bash")
process.arguments = ["-c", self]
process.standardOutput = pipe
process.standardError = pipe
process.executableURL = URL(fileURLWithPath: "/bin/bash")
process.arguments = ["-c", self]
process.standardOutput = pipe
process.standardError = pipe

if let safeCWD = cwd {
process.currentDirectoryURL = safeCWD
}
if let safeCWD = cwd {
process.currentDirectoryURL = safeCWD
}

let file = pipe.fileHandleForReading
let file = pipe.fileHandleForReading

do { try process.run() }
catch { return nil }
do { try process.run() }
catch { return nil }

process.waitUntilExit()
process.waitUntilExit()

guard process.terminationStatus == 0 else {
return nil
}
guard process.terminationStatus == 0 else {
return nil
}

let outputData = file.readDataToEndOfFile()
return String(data: outputData, encoding: .utf8)?
.trimmingCharacters(in: .whitespacesAndNewlines)
let outputData = file.readDataToEndOfFile()
return String(data: outputData, encoding: .utf8)?
.trimmingCharacters(in: .whitespacesAndNewlines)
#else
return nil
#endif
}
}

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.53.10"
let swiftFormatVersion = "0.54.0"
public let version = swiftFormatVersion

/// The standard SwiftFormat config file name
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.53.10",
"version": "0.54.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.53.10"
"tag": "0.54.0"
},
"default_subspecs": "Core",
"subspecs": [
Expand Down
12 changes: 6 additions & 6 deletions SwiftFormat.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 0.53.10;
MARKETING_VERSION = 0.54.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11";
PRODUCT_BUNDLE_IDENTIFIER = com.charcoaldesign.SwiftFormat;
Expand Down Expand Up @@ -1187,7 +1187,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 0.53.10;
MARKETING_VERSION = 0.54.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11";
PRODUCT_BUNDLE_IDENTIFIER = com.charcoaldesign.SwiftFormat;
Expand Down Expand Up @@ -1294,7 +1294,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 0.53.10;
MARKETING_VERSION = 0.54.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.SwiftFormat-for-Xcode";
PRODUCT_NAME = "SwiftFormat for Xcode";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -1325,7 +1325,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 0.53.10;
MARKETING_VERSION = 0.54.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.SwiftFormat-for-Xcode";
PRODUCT_NAME = "SwiftFormat for Xcode";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -1353,7 +1353,7 @@
"@executable_path/../../../../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 0.53.10;
MARKETING_VERSION = 0.54.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.SwiftFormat-for-Xcode.SourceEditorExtension";
PRODUCT_NAME = SwiftFormat;
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -1382,7 +1382,7 @@
"@executable_path/../../../../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 0.53.10;
MARKETING_VERSION = 0.54.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.charcoaldesign.SwiftFormat-for-Xcode.SourceEditorExtension";
PRODUCT_NAME = SwiftFormat;
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down

0 comments on commit dd989a4

Please sign in to comment.