Skip to content

Commit

Permalink
Merge pull request Quick#666 from Quick/swiftlint-correct-void_return
Browse files Browse the repository at this point in the history
[SwiftLint] Correct void_return rule
  • Loading branch information
jeffh authored Jan 6, 2017
2 parents 876d26e + 53313fc commit f189e8c
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion Sources/Quick/Configuration/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Foundation
A closure that temporarily exposes a Configuration object within
the scope of the closure.
*/
public typealias QuickConfigurer = (_ configuration: Configuration) -> ()
public typealias QuickConfigurer = (_ configuration: Configuration) -> Void

/**
A closure that, given metadata about an example, returns a boolean value
Expand Down
22 changes: 11 additions & 11 deletions Sources/Quick/DSL/DSL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public func afterSuite(_ closure: @escaping AfterSuiteClosure) {
using `describe` or `context`--the closure may contain any number of `beforeEach`
and `afterEach` closures, as well as any number of examples (defined using `it`).
*/
public func sharedExamples(_ name: String, closure: @escaping () -> ()) {
public func sharedExamples(_ name: String, closure: @escaping () -> Void) {
World.sharedWorld.sharedExamples(name, closure: { (NSDictionary) in closure() })
}

Expand Down Expand Up @@ -65,14 +65,14 @@ public func sharedExamples(_ name: String, closure: @escaping SharedExampleClosu
- parameter closure: A closure that can contain other examples.
- parameter flags: A mapping of string keys to booleans that can be used to filter examples or example groups.
*/
public func describe(_ description: String, flags: FilterFlags = [:], closure: () -> ()) {
public func describe(_ description: String, flags: FilterFlags = [:], closure: () -> Void) {
World.sharedWorld.describe(description, flags: flags, closure: closure)
}

/**
Defines an example group. Equivalent to `describe`.
*/
public func context(_ description: String, flags: FilterFlags = [:], closure: () -> ()) {
public func context(_ description: String, flags: FilterFlags = [:], closure: () -> Void) {
World.sharedWorld.context(description, flags: flags, closure: closure)
}

Expand Down Expand Up @@ -127,7 +127,7 @@ public func afterEach(_ closure: @escaping AfterExampleWithMetadataClosure) {
- parameter file: The absolute path to the file containing the example. A sensible default is provided.
- parameter line: The line containing the example. A sensible default is provided.
*/
public func it(_ description: String, flags: FilterFlags = [:], file: String = #file, line: UInt = #line, closure: @escaping () -> ()) {
public func it(_ description: String, flags: FilterFlags = [:], file: String = #file, line: UInt = #line, closure: @escaping () -> Void) {
World.sharedWorld.it(description, flags: flags, file: file, line: line, closure: closure)
}

Expand Down Expand Up @@ -174,31 +174,31 @@ public func itBehavesLike(_ name: String, flags: FilterFlags = [:], file: String
- parameter description: An arbitrary string describing the example or example group.
- parameter closure: A closure that will not be evaluated.
*/
public func pending(_ description: String, closure: () -> ()) {
public func pending(_ description: String, closure: () -> Void) {
World.sharedWorld.pending(description, closure: closure)
}

/**
Use this to quickly mark a `describe` closure as pending.
This disables all examples within the closure.
*/
public func xdescribe(_ description: String, flags: FilterFlags, closure: () -> ()) {
public func xdescribe(_ description: String, flags: FilterFlags, closure: () -> Void) {
World.sharedWorld.xdescribe(description, flags: flags, closure: closure)
}

/**
Use this to quickly mark a `context` closure as pending.
This disables all examples within the closure.
*/
public func xcontext(_ description: String, flags: FilterFlags, closure: () -> ()) {
public func xcontext(_ description: String, flags: FilterFlags, closure: () -> Void) {
xdescribe(description, flags: flags, closure: closure)
}

/**
Use this to quickly mark an `it` closure as pending.
This disables the example and ensures the code within the closure is never run.
*/
public func xit(_ description: String, flags: FilterFlags = [:], file: String = #file, line: UInt = #line, closure: @escaping () -> ()) {
public func xit(_ description: String, flags: FilterFlags = [:], file: String = #file, line: UInt = #line, closure: @escaping () -> Void) {
World.sharedWorld.xit(description, flags: flags, file: file, line: line, closure: closure)
}

Expand All @@ -207,22 +207,22 @@ public func xit(_ description: String, flags: FilterFlags = [:], file: String =
If any examples in the test suite are focused, only those examples are executed.
This trumps any explicitly focused or unfocused examples within the closure--they are all treated as focused.
*/
public func fdescribe(_ description: String, flags: FilterFlags = [:], closure: () -> ()) {
public func fdescribe(_ description: String, flags: FilterFlags = [:], closure: () -> Void) {
World.sharedWorld.fdescribe(description, flags: flags, closure: closure)
}

/**
Use this to quickly focus a `context` closure. Equivalent to `fdescribe`.
*/
public func fcontext(_ description: String, flags: FilterFlags = [:], closure: () -> ()) {
public func fcontext(_ description: String, flags: FilterFlags = [:], closure: () -> Void) {
fdescribe(description, flags: flags, closure: closure)
}

/**
Use this to quickly focus an `it` closure, focusing the example.
If any examples in the test suite are focused, only those examples are executed.
*/
public func fit(_ description: String, flags: FilterFlags = [:], file: String = #file, line: UInt = #line, closure: @escaping () -> ()) {
public func fit(_ description: String, flags: FilterFlags = [:], file: String = #file, line: UInt = #line, closure: @escaping () -> Void) {
World.sharedWorld.fit(description, flags: flags, file: file, line: line, closure: closure)
}

Expand Down
22 changes: 11 additions & 11 deletions Sources/Quick/DSL/World+DSL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extension World {
registerSharedExample(name, closure: closure)
}

internal func describe(_ description: String, flags: FilterFlags, closure: () -> ()) {
internal func describe(_ description: String, flags: FilterFlags, closure: () -> Void) {
guard currentExampleMetadata == nil else {
raiseError("'describe' cannot be used inside '\(currentPhase)', 'describe' may only be used inside 'context' or 'describe'. ")
}
Expand All @@ -30,20 +30,20 @@ extension World {
performWithCurrentExampleGroup(group, closure: closure)
}

internal func context(_ description: String, flags: FilterFlags, closure: () -> ()) {
internal func context(_ description: String, flags: FilterFlags, closure: () -> Void) {
guard currentExampleMetadata == nil else {
raiseError("'context' cannot be used inside '\(currentPhase)', 'context' may only be used inside 'context' or 'describe'. ")
}
self.describe(description, flags: flags, closure: closure)
}

internal func fdescribe(_ description: String, flags: FilterFlags, closure: () -> ()) {
internal func fdescribe(_ description: String, flags: FilterFlags, closure: () -> Void) {
var focusedFlags = flags
focusedFlags[Filter.focused] = true
self.describe(description, flags: focusedFlags, closure: closure)
}

internal func xdescribe(_ description: String, flags: FilterFlags, closure: () -> ()) {
internal func xdescribe(_ description: String, flags: FilterFlags, closure: () -> Void) {
var pendingFlags = flags
pendingFlags[Filter.pending] = true
self.describe(description, flags: pendingFlags, closure: closure)
Expand Down Expand Up @@ -85,7 +85,7 @@ extension World {
}
#endif

internal func it(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> ()) {
internal func it(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) {
if beforesCurrentlyExecuting {
raiseError("'it' cannot be used inside 'beforeEach', 'it' may only be used inside 'context' or 'describe'. ")
}
Expand All @@ -100,13 +100,13 @@ extension World {
currentExampleGroup.appendExample(example)
}

internal func fit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> ()) {
internal func fit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) {
var focusedFlags = flags
focusedFlags[Filter.focused] = true
self.it(description, flags: focusedFlags, file: file, line: line, closure: closure)
}

internal func xit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> ()) {
internal func xit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) {
var pendingFlags = flags
pendingFlags[Filter.pending] = true
self.it(description, flags: pendingFlags, file: file, line: line, closure: closure)
Expand Down Expand Up @@ -139,17 +139,17 @@ extension World {

#if _runtime(_ObjC)
@objc(itWithDescription:flags:file:line:closure:)
private func objc_it(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> ()) {
private func objc_it(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) {
it(description, flags: flags, file: file, line: line, closure: closure)
}

@objc(fitWithDescription:flags:file:line:closure:)
private func objc_fit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> ()) {
private func objc_fit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) {
fit(description, flags: flags, file: file, line: line, closure: closure)
}

@objc(xitWithDescription:flags:file:line:closure:)
private func objc_xit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> ()) {
private func objc_xit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> Void) {
xit(description, flags: flags, file: file, line: line, closure: closure)
}

Expand All @@ -159,7 +159,7 @@ extension World {
}
#endif

internal func pending(_ description: String, closure: () -> ()) {
internal func pending(_ description: String, closure: () -> Void) {
print("Pending: \(description)")
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/Quick/Example.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ final public class Example: NSObject {
weak internal var group: ExampleGroup?

private let internalDescription: String
private let closure: () -> ()
private let closure: () -> Void
private let flags: FilterFlags

internal init(description: String, callsite: Callsite, flags: FilterFlags, closure: @escaping () -> ()) {
internal init(description: String, callsite: Callsite, flags: FilterFlags, closure: @escaping () -> Void) {
self.internalDescription = description
self.closure = closure
self.callsite = callsite
Expand Down
10 changes: 5 additions & 5 deletions Sources/Quick/ExampleGroup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ final public class ExampleGroup: NSObject {

internal var filterFlags: FilterFlags {
var aggregateFlags = flags
walkUp() { (group: ExampleGroup) -> () in
walkUp() { group in
for (key, value) in group.flags {
aggregateFlags[key] = value
}
Expand All @@ -60,21 +60,21 @@ final public class ExampleGroup: NSObject {

internal var befores: [BeforeExampleWithMetadataClosure] {
var closures = Array(hooks.befores.reversed())
walkUp() { (group: ExampleGroup) -> () in
walkUp() { group in
closures.append(contentsOf: Array(group.hooks.befores.reversed()))
}
return Array(closures.reversed())
}

internal var afters: [AfterExampleWithMetadataClosure] {
var closures = hooks.afters
walkUp() { (group: ExampleGroup) -> () in
walkUp() { group in
closures.append(contentsOf: group.hooks.afters)
}
return closures
}

internal func walkDownExamples(_ callback: (_ example: Example) -> ()) {
internal func walkDownExamples(_ callback: (_ example: Example) -> Void) {
for example in childExamples {
callback(example)
}
Expand All @@ -93,7 +93,7 @@ final public class ExampleGroup: NSObject {
childExamples.append(example)
}

private func walkUp(_ callback: (_ group: ExampleGroup) -> ()) {
private func walkUp(_ callback: (_ group: ExampleGroup) -> Void) {
var group = self
while let parent = group.parent {
callback(parent)
Expand Down
6 changes: 3 additions & 3 deletions Sources/Quick/Hooks/Closures.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
/**
A closure executed before an example is run.
*/
public typealias BeforeExampleClosure = () -> ()
public typealias BeforeExampleClosure = () -> Void

/**
A closure executed before an example is run. The closure is given example metadata,
which contains information about the example that is about to be run.
*/
public typealias BeforeExampleWithMetadataClosure = (_ exampleMetadata: ExampleMetadata) -> ()
public typealias BeforeExampleWithMetadataClosure = (_ exampleMetadata: ExampleMetadata) -> Void

/**
A closure executed after an example is run.
Expand All @@ -27,7 +27,7 @@ public typealias AfterExampleWithMetadataClosure = BeforeExampleWithMetadataClos
/**
A closure executed before any examples are run.
*/
public typealias BeforeSuiteClosure = () -> ()
public typealias BeforeSuiteClosure = () -> Void

/**
A closure executed after all examples have finished running.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Quick/World.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public typealias SharedExampleContext = () -> [String: Any]
A closure that is used to define a group of shared examples. This
closure may contain any number of example and example groups.
*/
public typealias SharedExampleClosure = (@escaping SharedExampleContext) -> ()
public typealias SharedExampleClosure = (@escaping SharedExampleContext) -> Void

/**
A collection of state Quick builds up in order to work its magic.
Expand Down

0 comments on commit f189e8c

Please sign in to comment.