Update SwiftLint to 0.39.2 (#295)

* Update SwiftLint to 0.39.2

* Enable a bunch of extra rules

* Fix all warnings

* Ignore this Xcode generated folder

Co-authored-by: Olivier Halligon <olivier@halligon.net>
This commit is contained in:
David Jennes
2020-08-12 22:52:00 +02:00
committed by GitHub
parent a84cd3d877
commit 19646bcddf
15 changed files with 95 additions and 48 deletions

View File

@@ -133,7 +133,7 @@ final class EnvironmentTests: XCTestCase {
token: "name|unknown"
)
}
it("reports error in variable tag") {
self.template = "{{ }}"
try self.expectError(reason: "Missing variable name", token: " ")
@@ -261,11 +261,13 @@ final class EnvironmentIncludeTemplateTests: XCTestCase {
function: String = #function
) throws {
var expectedError = expectedSyntaxError(token: token, template: template, description: reason)
expectedError.stackTrace = [expectedSyntaxError(
token: includedToken,
template: includedTemplate,
description: reason
).token].compactMap { $0 }
expectedError.stackTrace = [
expectedSyntaxError(
token: includedToken,
template: includedTemplate,
description: reason
).token
].compactMap { $0 }
let error = try expect(
self.environment.render(template: self.template, context: ["target": "World"]),
@@ -368,11 +370,13 @@ final class EnvironmentBaseAndChildTemplateTests: XCTestCase {
) throws {
var expectedError = expectedSyntaxError(token: childToken, template: childTemplate, description: reason)
if let baseToken = baseToken {
expectedError.stackTrace = [expectedSyntaxError(
token: baseToken,
template: baseTemplate,
description: reason
).token].compactMap { $0 }
expectedError.stackTrace = [
expectedSyntaxError(
token: baseToken,
template: baseTemplate,
description: reason
).token
].compactMap { $0 }
}
let error = try expect(
self.environment.render(template: self.childTemplate, context: ["target": "World"]),

View File

@@ -325,10 +325,12 @@ final class FilterTests: XCTestCase {
let template = Template(templateString: """
{{ value|indent:2 }}
""")
let result = try template.render(Context(dictionary: ["value": """
let result = try template.render(Context(dictionary: [
"value": """
One
Two
"""]))
"""
]))
try expect(result) == """
One
Two
@@ -339,10 +341,12 @@ final class FilterTests: XCTestCase {
let template = Template(templateString: """
{{ value|indent:2,"\t" }}
""")
let result = try template.render(Context(dictionary: ["value": """
let result = try template.render(Context(dictionary: [
"value": """
One
Two
"""]))
"""
]))
try expect(result) == """
One
\t\tTwo
@@ -353,10 +357,12 @@ final class FilterTests: XCTestCase {
let template = Template(templateString: """
{{ value|indent:2," ",true }}
""")
let result = try template.render(Context(dictionary: ["value": """
let result = try template.render(Context(dictionary: [
"value": """
One
Two
"""]))
"""
]))
try expect(result) == """
One
Two
@@ -367,14 +373,16 @@ final class FilterTests: XCTestCase {
let template = Template(templateString: """
{{ value|indent }}
""")
let result = try template.render(Context(dictionary: ["value": """
let result = try template.render(Context(dictionary: [
"value": """
One
Two
"""]))
"""
]))
try expect(result) == """
One

View File

@@ -127,7 +127,8 @@ final class LexerTests: XCTestCase {
}
func testCombiningDiaeresis() throws {
// the symbol "ü" in the `templateString` is unusually encoded as 0x75 0xCC 0x88 (LATIN SMALL LETTER U + COMBINING DIAERESIS) instead of 0xC3 0xBC (LATIN SMALL LETTER U WITH DIAERESIS)
// the symbol "ü" in the `templateString` is unusually encoded as 0x75 0xCC 0x88 (LATIN SMALL LETTER U + COMBINING
// DIAERESIS) instead of 0xC3 0xBC (LATIN SMALL LETTER U WITH DIAERESIS)
let templateString = "\n{% if test %}ü{% endif %}\n{% if ü %}ü{% endif %}\n"
let lexer = Lexer(templateString: templateString)
let tokens = lexer.tokenize()