Skip to content

Commit

Permalink
New swiftlint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
djbe committed Apr 9, 2018
1 parent a555171 commit eb1d2ac
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ opt_in_rules:
- closure_spacing
- contains_over_first_not_nil
- discouraged_optional_boolean
- discouraged_optional_collection
- empty_count
- empty_string
- fatal_error_message
- first_where
- force_unwrapping
Expand All @@ -26,6 +28,7 @@ opt_in_rules:
- sorted_imports
- trailing_closure
- unneeded_parentheses_in_closure_argument
- untyped_error_in_catch
- vertical_parameter_alignment_on_call
- yoda_condition

Expand Down
1 change: 1 addition & 0 deletions Sources/StencilSwiftTemplate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ open class StencilSwiftTemplate: Template {
super.init(templateString: templateStringWithMarkedNewlines, environment: environment, name: name)
}

// swiftlint:disable:next discouraged_optional_collection
open override func render(_ dictionary: [String: Any]? = nil) throws -> String {
return try removeExtraLines(from: super.render(dictionary))
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/StencilSwiftKitTests/StringFiltersTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ extension StringFiltersTests {
XCTFail("Code did succeed while it was expected to fail for wrong option")
} catch Filters.Error.invalidOption {
// That's the expected exception we want to happen
} catch let error {
} catch let error as Error {
XCTFail("Unexpected error occured: \(error)")
}
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/StencilSwiftKitTests/SwiftIdentifierTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ extension SwiftIdentifierTests {
XCTFail("Code did succeed while it was expected to fail for wrong option")
} catch Filters.Error.invalidOption {
// That's the expected exception we want to happen
} catch let error {
} catch let error as Error {
XCTFail("Unexpected error occured: \(error)")
}
}
Expand Down
4 changes: 2 additions & 2 deletions Tests/StencilSwiftKitTests/TestsHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ class Fixtures {
let subDir: String? = name.hasSuffix(".stencil") ? "fixtures" : "expected"
do {
return try path(for: name, subDirectory: subDir).read(encoding)
} catch let e {
fatalError("Unable to load fixture content: \(e)")
} catch let error as Error {
fatalError("Unable to load fixture content: \(error)")
}
}
}

0 comments on commit eb1d2ac

Please sign in to comment.