Skip to content

Commit 2aa6ff1

Browse files
authored
Merge pull request #96 from SwiftGen/feature/swiftlint-0.27
SwiftLint 0.27
2 parents 2f5f77a + c43cb10 commit 2aa6ff1

10 files changed

+29
-17
lines changed

.swiftlint.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,30 @@
11
opt_in_rules:
2+
- anyobject_protocol
23
- array_init
34
- attributes
45
- closure_end_indentation
56
- closure_spacing
67
- contains_over_first_not_nil
8+
- convenience_type
79
- discouraged_optional_boolean
810
- discouraged_optional_collection
911
- empty_count
1012
- empty_string
13+
- fallthrough
1114
- fatal_error_message
1215
- first_where
1316
- force_unwrapping
1417
- implicit_return
1518
- implicitly_unwrapped_optional
1619
- joined_default_parameter
1720
- literal_expression_end_indentation
21+
- lower_acl_than_parent
22+
- modifier_order
1823
- multiline_arguments
24+
- multiline_function_chains
1925
- multiline_parameters
26+
- number_separator
27+
- object_literal
2028
- operator_usage_whitespace
2129
- overridden_super_call
2230
- override_in_extension
@@ -27,6 +35,7 @@ opt_in_rules:
2735
- sorted_first_last
2836
- sorted_imports
2937
- trailing_closure
38+
- unavailable_function
3039
- unneeded_parentheses_in_closure_argument
3140
- vertical_parameter_alignment_on_call
3241
- yoda_condition

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
* Updated to latest Xcode (9.3.0).
3737
[David Jennes](https://github.com/djbe)
3838
[#86](https://github.com/SwiftGen/StencilSwiftKit/pull/86)
39+
* Update to SwiftLint 0.27 and enable some extra SwiftLint rules.
40+
[David Jennes](https://github.com/djbe)
41+
[#96](https://github.com/SwiftGen/StencilSwiftKit/pull/96)
3942

4043
## 2.5.0
4144

Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ PODS:
44
- PathKit (~> 0.8.0)
55
- StencilSwiftKit (2.5.0):
66
- Stencil (~> 0.12)
7-
- SwiftLint (0.25.1)
7+
- SwiftLint (0.27.0)
88

99
DEPENDENCIES:
1010
- StencilSwiftKit (from `.`)
@@ -24,7 +24,7 @@ SPEC CHECKSUMS:
2424
PathKit: dcab05d701474011aae0e40cf892298a831f63d6
2525
Stencil: c324035607f483153c780fb42367d284cadd30a6
2626
StencilSwiftKit: 80a778f61bb742fd7714a5f9f3c2249d2eafa594
27-
SwiftLint: ce933681be10c3266e82576dad676fa815a602e9
27+
SwiftLint: 3207c1faa2240bf8973b191820a116113cd11073
2828

2929
PODFILE CHECKSUM: 0bd9ec310bace9d5b62e785ea1fb74547c15074d
3030

Pods/Manifest.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/SwiftLint/swiftlint

532 KB
Binary file not shown.

Sources/SetNode.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Stencil
99
class SetNode: NodeType {
1010
enum Content {
1111
case nodes([NodeType])
12-
case reference(to: Resolvable)
12+
case reference(resolvable: Resolvable)
1313
}
1414

1515
let variableName: String
@@ -29,7 +29,7 @@ class SetNode: NodeType {
2929
if components.count == 3 {
3030
// we have a value expression, no nodes
3131
let resolvable = try parser.compileResolvable(components[2], containedIn: token)
32-
return SetNode(variableName: variable, content: .reference(to: resolvable))
32+
return SetNode(variableName: variable, content: .reference(resolvable: resolvable))
3333
} else {
3434
// no value expression, parse until an `endset` node
3535
let setNodes = try parser.parse(until(["endset"]))

Sources/StencilSwiftTemplate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ open class StencilSwiftTemplate: Template {
2121
}
2222

2323
// swiftlint:disable:next discouraged_optional_collection
24-
open override func render(_ dictionary: [String: Any]? = nil) throws -> String {
24+
override open func render(_ dictionary: [String: Any]? = nil) throws -> String {
2525
return try removeExtraLines(from: super.render(dictionary))
2626
}
2727

Tests/StencilSwiftKitTests/SetNodeTests.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class SetNodeTests: XCTestCase {
105105
}
106106

107107
do {
108-
let node = SetNode(variableName: "value", content: .reference(to: Variable("test")))
108+
let node = SetNode(variableName: "value", content: .reference(resolvable: Variable("test")))
109109
let context = Context(dictionary: [:])
110110
let output = try node.render(context)
111111
XCTAssertEqual(output, "")
@@ -141,14 +141,14 @@ class SetNodeTests: XCTestCase {
141141
XCTAssertNil(context["c"])
142142

143143
// alias a into c
144-
node = SetNode(variableName: "c", content: .reference(to: Variable("a")))
144+
node = SetNode(variableName: "c", content: .reference(resolvable: Variable("a")))
145145
_ = try node.render(context)
146146
XCTAssertEqual(context["a"] as? String, "hi")
147147
XCTAssertEqual(context["b"] as? String, "world")
148148
XCTAssertEqual(context["c"] as? String, "hi")
149149

150150
// alias non-existing into c
151-
node = SetNode(variableName: "c", content: .reference(to: Variable("foo")))
151+
node = SetNode(variableName: "c", content: .reference(resolvable: Variable("foo")))
152152
_ = try node.render(context)
153153
XCTAssertEqual(context["a"] as? String, "hi")
154154
XCTAssertEqual(context["b"] as? String, "world")
@@ -177,14 +177,14 @@ class SetNodeTests: XCTestCase {
177177
XCTAssertEqual(context["c"] as? Int, 3)
178178

179179
// alias a into c
180-
node = SetNode(variableName: "c", content: .reference(to: Variable("a")))
180+
node = SetNode(variableName: "c", content: .reference(resolvable: Variable("a")))
181181
_ = try node.render(context)
182182
XCTAssertEqual(context["a"] as? String, "hello")
183183
XCTAssertEqual(context["b"] as? String, "world")
184184
XCTAssertEqual(context["c"] as? String, "hello")
185185

186186
// alias non-existing into c
187-
node = SetNode(variableName: "c", content: .reference(to: Variable("foo")))
187+
node = SetNode(variableName: "c", content: .reference(resolvable: Variable("foo")))
188188
_ = try node.render(context)
189189
XCTAssertEqual(context["a"] as? String, "hello")
190190
XCTAssertEqual(context["b"] as? String, "world")
@@ -238,7 +238,7 @@ class SetNodeTests: XCTestCase {
238238
XCTAssertNil(context["c"])
239239

240240
// alias a into c
241-
node = SetNode(variableName: "c", content: .reference(to: Variable("a")))
241+
node = SetNode(variableName: "c", content: .reference(resolvable: Variable("a")))
242242
_ = try node.render(context)
243243
XCTAssertEqual(context["a"] as? String, "hello")
244244
XCTAssertEqual(context["b"] as? Int, 2)
@@ -264,7 +264,7 @@ class SetNodeTests: XCTestCase {
264264
XCTAssertNil(context["b"])
265265

266266
// set b
267-
node = SetNode(variableName: "b", content: .reference(to: Variable("items")))
267+
node = SetNode(variableName: "b", content: .reference(resolvable: Variable("items")))
268268
_ = try node.render(context)
269269
XCTAssertEqual(context["b"] as? [Int], [1, 3, 7])
270270
}
@@ -274,7 +274,7 @@ class SetNodeTests: XCTestCase {
274274

275275
let parser = TokenParser(tokens: [], environment: stencilSwiftEnvironment())
276276
let argument = try FilterExpression(token: "greet|uppercase", parser: parser)
277-
let node = SetNode(variableName: "a", content: .reference(to: argument))
277+
let node = SetNode(variableName: "a", content: .reference(resolvable: argument))
278278

279279
_ = try node.render(context)
280280
XCTAssertEqual(context["a"] as? String, "HELLO")

Tests/StencilSwiftKitTests/StringFiltersTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final class StringFiltersTests: XCTestCase {
2929
return stringRepresentation.hashValue
3030
}
3131

32-
public static func == (lhs: Input, rhs: Input) -> Bool {
32+
static func == (lhs: Input, rhs: Input) -> Bool {
3333
return lhs.stringRepresentation == rhs.stringRepresentation
3434
}
3535
}

Tests/StencilSwiftKitTests/TestsHelper.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ private let koCode = (num: colorCode("fg127,127,127") + colorCode("bg127,0,0"),
1818

1919
func diff(_ result: String, _ expected: String) -> String? {
2020
guard result != expected else { return nil }
21-
var firstDiff: Int? = nil
21+
var firstDiff: Int?
2222
let newlines = CharacterSet.newlines
2323
let lhsLines = result.components(separatedBy: newlines)
2424
let rhsLines = expected.components(separatedBy: newlines)

0 commit comments

Comments
 (0)