Skip to content

Commit

Permalink
Updated for 0.12 release
Browse files Browse the repository at this point in the history
nicklockwood committed Oct 8, 2016
1 parent 5f7cd9b commit 73fd63f
Showing 10 changed files with 157 additions and 155 deletions.
4 changes: 2 additions & 2 deletions CommandLineTool/main.swift
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
// main.swift
// SwiftFormat
//
// Version 0.11.4
// Version 0.12
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Charcoal Design
@@ -33,7 +33,7 @@

import Foundation

let version = "0.11.4"
let version = "0.12"

func showHelp() {
print("swiftformat, version \(version)")
Binary file modified CommandLineTool/swiftformat
Binary file not shown.
2 changes: 1 addition & 1 deletion LICENCE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SwiftFormat

Version 0.11.4, October 5th, 2016
Version 0.12, October 8th, 2016

Copyright (c) 2016 Nick Lockwood

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -403,11 +403,13 @@ What's next?
Release notes
----------------

Version ?
Version 0.12

- Linewrapped `case` elements are now vertically aligned
- The `else` keyword in a `guard` statement is no longer indented
- The `elseOnSameLine` rule is no longer applied if previous `} is not on its own line
- Fixed handling of `case` after comma in an `if` statement
- Added support for formatting partial file fragments
- Reduced compilation time by ~500ms

Version 0.11.4
2 changes: 1 addition & 1 deletion SwiftFormat/Formatter.swift
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
// Formatter.swift
// SwiftFormat
//
// Version 0.11.4
// Version 0.12
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Charcoal Design
148 changes: 74 additions & 74 deletions SwiftFormat/Rules.swift
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
// Rules.swift
// SwiftFormat
//
// Version 0.11.4
// Version 0.12
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Charcoal Design
@@ -46,23 +46,23 @@ public func spaceAroundParens(_ formatter: Formatter) {
func spaceAfter(_ identifier: String, index: Int) -> Bool {
switch identifier {
case "internal",
"case",
"for",
"guard",
"if",
"in",
"return",
"switch",
"where",
"while",
"as",
"catch",
"is",
"let",
"rethrows",
"throw",
"throws",
"try":
"case",
"for",
"guard",
"if",
"in",
"return",
"switch",
"where",
"while",
"as",
"catch",
"is",
"let",
"rethrows",
"throw",
"throws",
"try":
return formatter.previousNonWhitespaceToken(fromIndex: index)?.string != "."
default:
return false
@@ -152,15 +152,15 @@ public func spaceAroundBrackets(_ formatter: Formatter) {
func spaceAfter(_ identifier: String, index: Int) -> Bool {
switch identifier {
case "case",
"guard",
"if",
"in",
"return",
"switch",
"where",
"while",
"as",
"is":
"guard",
"if",
"in",
"return",
"switch",
"where",
"while",
"as",
"is":
return formatter.previousNonWhitespaceToken(fromIndex: index)?.string != "."
default:
return false
@@ -319,16 +319,16 @@ public func spaceAroundOperators(_ formatter: Formatter) {
func spaceAfter(_ identifier: String, index: Int) -> Bool {
switch identifier {
case "case",
"guard",
"if",
"in",
"let",
"return",
"switch",
"where",
"while",
"as",
"is":
"guard",
"if",
"in",
"let",
"return",
"switch",
"where",
"while",
"as",
"is":
return formatter.previousNonWhitespaceToken(fromIndex: index)?.string != "."
default:
return false
@@ -641,10 +641,10 @@ public func blankLinesBetweenScopes(_ formatter: Formatter) {
nextToken.type == .identifier {
switch nextToken.string {
case "var", "let", "func",
"private", "fileprivate", "public", "internal", "open",
"final", "required", "override", "convenience",
"lazy", "dynamic", "static",
"prefix", "postfix":
"private", "fileprivate", "public", "internal", "open",
"final", "required", "override", "convenience",
"lazy", "dynamic", "static",
"prefix", "postfix":
return
default:
break
@@ -716,8 +716,8 @@ public func blankLinesBetweenScopes(_ formatter: Formatter) {
case .identifier:
switch token.string {
case "private", "fileprivate", "internal", "public", "open",
"final", "required", "override", "convenience",
"prefix", "postfix":
"final", "required", "override", "convenience",
"prefix", "postfix":
break
default:
if !token.string.hasPrefix("@") {
@@ -829,26 +829,26 @@ public func indent(_ formatter: Formatter) {
// prefix, Protocol, required, right, set, Type, unowned, weak, willSet
switch token.string {
case "associatedtype",
"import",
"init",
"inout",
"let",
"subscript",
"var",
"case",
"default",
"for",
"guard",
"if",
"switch",
"where",
"while",
"as",
"catch",
"is",
"super",
"throw",
"try":
"import",
"init",
"inout",
"let",
"subscript",
"var",
"case",
"default",
"for",
"guard",
"if",
"switch",
"where",
"while",
"as",
"catch",
"is",
"super",
"throw",
"try":
return formatter.previousNonWhitespaceToken(fromIndex: i)?.string == "."
default:
return true
@@ -888,14 +888,14 @@ public func indent(_ formatter: Formatter) {
// TODO: handle "in"
switch token.string {
case "as",
"dynamicType",
"false",
"is",
"nil",
"rethrows",
"throws",
"true",
"where":
"dynamicType",
"false",
"is",
"nil",
"rethrows",
"throws",
"true",
"where":
return false
default:
return true
@@ -1255,9 +1255,9 @@ public func specifiers(_ formatter: Formatter) {
}
switch token.string {
case "let", "var",
"typealias", "associatedtype",
"class", "struct", "enum", "protocol", "extension",
"func", "init", "subscript":
"typealias", "associatedtype",
"class", "struct", "enum", "protocol", "extension",
"func", "init", "subscript":
break
default:
return
2 changes: 1 addition & 1 deletion SwiftFormat/SwiftFormat.h
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
// SwiftFormat.h
// SwiftFormat
//
// Version 0.11.4
// Version 0.12
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Charcoal Design
2 changes: 1 addition & 1 deletion SwiftFormat/SwiftFormat.swift
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
// SwiftFormat.swift
// SwiftFormat
//
// Version 0.11.4
// Version 0.12
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Charcoal Design
Loading

0 comments on commit 73fd63f

Please sign in to comment.