Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Nimble SwiftLint compatible #370 #392

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ import Foundation
var behaviors = execTypesCountTuple<exception_behavior_t>()
var flavors = execTypesCountTuple<thread_state_flavor_t>()
var currentExceptionPort: mach_port_t = 0
var handlerThread: pthread_t? = nil
var handlerThread: pthread_t?

mutating func withUnsafeMutablePointers<R>(in block: (UnsafeMutablePointer<exception_mask_t>, UnsafeMutablePointer<mach_port_t>, UnsafeMutablePointer<exception_behavior_t>, UnsafeMutablePointer<thread_state_flavor_t>) -> R) -> R {
return masks.pointer { masksPtr in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private func triggerLongJmp() {
longjmp(&env.0, 1)
}

private func sigIllHandler(code: Int32, info: UnsafeMutablePointer<__siginfo>?, uap: UnsafeMutableRawPointer?) -> Void {
private func sigIllHandler(code: Int32, info: UnsafeMutablePointer<__siginfo>?, uap: UnsafeMutableRawPointer?) {
guard let context = uap?.assumingMemoryBound(to: ucontext64_t.self) else { return }

// 1. Decrement the stack pointer
Expand Down
10 changes: 5 additions & 5 deletions Sources/Nimble/DSL+Wait.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal class NMBWait: NSObject {
timeout: TimeInterval,
file: FileString = #file,
line: UInt = #line,
action: @escaping (@escaping () -> Void) -> Void) -> Void {
action: @escaping (@escaping () -> Void) -> Void) {
return throwableUntil(timeout: timeout, file: file, line: line) { done in
action(done)
}
Expand All @@ -26,7 +26,7 @@ internal class NMBWait: NSObject {
timeout: TimeInterval,
file: FileString = #file,
line: UInt = #line,
action: @escaping (@escaping () -> Void) throws -> Void) -> Void {
action: @escaping (@escaping () -> Void) throws -> Void) {
let awaiter = NimbleEnvironment.activeInstance.awaiter
let leeway = timeout / 2.0
let result = awaiter.performBlock { (done: @escaping (ErrorResult) -> Void) throws -> Void in
Expand Down Expand Up @@ -71,12 +71,12 @@ internal class NMBWait: NSObject {
}

#if SWIFT_PACKAGE
internal class func until(_ file: FileString = #file, line: UInt = #line, action: @escaping (() -> Void) -> Void) -> Void {
internal class func until(_ file: FileString = #file, line: UInt = #line, action: @escaping (() -> Void) -> Void) {
until(timeout: 1, file: file, line: line, action: action)
}
#else
@objc(untilFile:line:action:)
internal class func until(_ file: FileString = #file, line: UInt = #line, action: @escaping (() -> Void) -> Void) -> Void {
internal class func until(_ file: FileString = #file, line: UInt = #line, action: @escaping (() -> Void) -> Void) {
until(timeout: 1, file: file, line: line, action: action)
}
#endif
Expand All @@ -93,6 +93,6 @@ internal func blockedRunLoopErrorMessageFor(_ fnName: String, leeway: TimeInterv
///
/// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function
/// is executing. Any attempts to touch the run loop may cause non-deterministic behavior.
public func waitUntil(timeout: TimeInterval = 1, file: FileString = #file, line: UInt = #line, action: @escaping (@escaping () -> Void) -> Void) -> Void {
public func waitUntil(timeout: TimeInterval = 1, file: FileString = #file, line: UInt = #line, action: @escaping (@escaping () -> Void) -> Void) {
NMBWait.until(timeout: timeout, file: file, line: line, action: action)
}
4 changes: 2 additions & 2 deletions Sources/Nimble/FailureMessage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ public class FailureMessage: NSObject {
/// An optional message that will be appended as a new line and provides additional details
/// about the failure. This message will only be visible in the issue navigator / in logs but
/// not directly in the source editor since only a single line is presented there.
public var extendedMessage: String? = nil
public var userDescription: String? = nil
public var extendedMessage: String?
public var userDescription: String?

public var stringValue: String {
get {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Nimble/Utils/Async.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ internal protocol WaitLock {
}

internal class AssertionWaitLock: WaitLock {
private var currentWaiter: WaitingInfo? = nil
private var currentWaiter: WaitingInfo?
init() { }

func acquireWaitingLock(_ fnName: String, file: FileString, line: UInt) {
Expand Down
2 changes: 1 addition & 1 deletion Tests/NimbleTests/Matchers/BeIdenticalToTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ final class BeIdenticalToTest: XCTestCase, XCTestCaseProvider {
func testBeAlias() {
let value = NSDate()
expect(value).to(be(value))
expect(NSNumber(value:1)).toNot(be(NSString(stringLiteral: "turtles")))
expect(NSNumber(value:1)).toNot(be(NSString(stringLiteral: "turtles"))) // swiftlint:disable:this compiler_protocol_init
Copy link
Member

@wongzigii wongzigii Feb 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this disable rule necessary? Otherwise looks good to me.

#if _runtime(_ObjC)
expect([1]).toNot(be([1]))
#else
Expand Down