Skip to content

Commit

Permalink
Merge pull request #562 from Quick/swiftlint-force_cast
Browse files Browse the repository at this point in the history
[SwiftLint] Remove force_cast from disabled_rules
  • Loading branch information
wongzigii committed Jul 5, 2018
2 parents 7f550dd + ce743cd commit 61847ca
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 1 deletion.
1 change: 0 additions & 1 deletion .swiftlint.yml
Expand Up @@ -2,7 +2,6 @@ disabled_rules:
- todo
- variable_name
- force_try
- force_cast

included:
- Sources
Expand Down
1 change: 1 addition & 0 deletions Sources/Nimble/Matchers/BeginWith.swift
Expand Up @@ -49,6 +49,7 @@ extension NMBObjCMatcher {
let actual = try! actualExpression.evaluate()
if (actual as? String) != nil {
let expr = actualExpression.cast { $0 as? String }
// swiftlint:disable:next force_cast
return try! beginWith(expected as! String).matches(expr, failureMessage: failureMessage)
} else {
let expr = actualExpression.cast { $0 as? NMBOrderedCollection }
Expand Down
1 change: 1 addition & 0 deletions Sources/Nimble/Matchers/Contain.swift
Expand Up @@ -81,6 +81,7 @@ extension NMBObjCMatcher {
return try! contain(expectedOptionals).matches(expr, failureMessage: failureMessage)
} else if let value = actualValue as? NSString {
let expr = Expression(expression: ({ value as String }), location: location)
// swiftlint:disable:next force_cast
return try! contain(expected as! [String]).matches(expr, failureMessage: failureMessage)
} else if actualValue != nil {
// swiftlint:disable:next line_length
Expand Down
1 change: 1 addition & 0 deletions Sources/Nimble/Matchers/EndWith.swift
Expand Up @@ -61,6 +61,7 @@ extension NMBObjCMatcher {
let actual = try! actualExpression.evaluate()
if (actual as? String) != nil {
let expr = actualExpression.cast { $0 as? String }
// swiftlint:disable:next force_cast
return try! endWith(expected as! String).matches(expr, failureMessage: failureMessage)
} else {
let expr = actualExpression.cast { $0 as? NMBOrderedCollection }
Expand Down
2 changes: 2 additions & 0 deletions Sources/Nimble/Matchers/MatcherProtocols.swift
Expand Up @@ -144,11 +144,13 @@ public protocol NMBComparable {

extension NSNumber: NMBComparable {
public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult {
// swiftlint:disable:next force_cast
return compare(otherObject as! NSNumber)
}
}
extension NSString: NMBComparable {
public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult {
// swiftlint:disable:next force_cast
return compare(otherObject as! String)
}
}

0 comments on commit 61847ca

Please sign in to comment.