Skip to content

Commit

Permalink
Merge pull request #144 from ikesyo/fix-swiftlint-yml
Browse files Browse the repository at this point in the history
Update .swiftlint.yml and fix some violations
  • Loading branch information
ikesyo authored Aug 12, 2016
2 parents cb4ded9 + 6895de8 commit 706a8aa
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 13 deletions.
9 changes: 7 additions & 2 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
disabled_rules:
- line_length
- valid_docs
included:
- Himotoki
- HimotokiTests
- Sources
- Tests

variable_name:
excluded:
- e
6 changes: 3 additions & 3 deletions Sources/Extractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ extension Extractor: CustomStringConvertible {
// See https://gist.github.com/norio-nomura/d9ec7212f2cfde3fb662.
private func valueFor<C: CollectionType where C.Generator.Element == String, C.SubSequence == C>(keyPathComponents: C, _ JSON: AnyJSON) -> AnyJSON? {
#if os(Linux)
guard let
first = keyPathComponents.first,
guard
let first = keyPathComponents.first,
let nativeDict = JSON as? [String: AnyJSON],
case let nested? = nativeDict[first] where !(nested is NSNull) else
case let nested? = nativeDict[first] where !(nested is NSNull) else // swiftlint:disable:this opening_brace
{
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/Himotoki/DecodableTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class DecodableTest: XCTestCase {
return JSON
}()

func testPerson() {
func testPerson() { // swiftlint:disable:this function_body_length
var JSON = personJSON

// Succeeding case
Expand Down
8 changes: 4 additions & 4 deletions Tests/Himotoki/DecodeErrorTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ private struct URLHolder: Decodable {
}
}

private struct A: Decodable {
let b: B?
private struct A: Decodable { // swiftlint:disable:this type_name
let b: B? // swiftlint:disable:this variable_name

static func decode(e: Extractor) throws -> A {
return self.init(b: try e <|? "b")
}
}

private struct B: Decodable {
private struct B: Decodable { // swiftlint:disable:this type_name
let string: String

static func decode(e: Extractor) throws -> B {
Expand Down Expand Up @@ -74,7 +74,7 @@ class DecodeErrorTest: XCTestCase {

func testMissingKeyPathAndDecodeFailure() {
let d: [String: AnyJSON] = [:]
let a = try! A.decodeValue(d)
let a = try! A.decodeValue(d) // swiftlint:disable:this force_try
XCTAssertNil(a.b)

do {
Expand Down
2 changes: 1 addition & 1 deletion Tests/Himotoki/KeyPathTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ extension KeyPathTest: XCTestCaseProvider {
]
}
}

#endif
2 changes: 1 addition & 1 deletion Tests/Himotoki/RawRepresentableTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class RawRepresentableTest: XCTestCase {
"double_2": 4.0,
]

let e = try! Extractor.decodeValue(JSON)
let e = try! Extractor.decodeValue(JSON) // swiftlint:disable:this force_try

let A: StringEnum? = try? e <| "string_1"
let D: StringEnum? = try? e <| "string_2"
Expand Down
2 changes: 1 addition & 1 deletion Tests/Himotoki/TransformerTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation
import XCTest
import Himotoki

private func toURL(s: String) throws -> NSURL {
private func toURL(s: String) throws -> NSURL { // swiftlint:disable:this variable_name
if let URL = NSURL(string: s) {
return URL
}
Expand Down

0 comments on commit 706a8aa

Please sign in to comment.