Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove some of the swiftlint generated warnings #229

Merged
merged 1 commit into from Sep 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/XMLCoder/Auxiliaries/XMLStackParser.swift
Expand Up @@ -146,7 +146,7 @@ extension XMLStackParser: XMLParserDelegate {
}

let updatedElement = removeWhitespaceElements ? elementWithFilteredElements(element: element) : element

withCurrentElement { currentElement in
currentElement.append(element: updatedElement, forKey: updatedElement.key)
}
Expand Down
4 changes: 1 addition & 3 deletions Sources/XMLCoder/Decoder/DecodingErrorExtension.swift
Expand Up @@ -8,9 +8,7 @@

import Foundation

//===----------------------------------------------------------------------===//
// Error Utilities
//===----------------------------------------------------------------------===//
// MARK: - Error Utilities

extension DecodingError {
/// Returns a `.typeMismatch` error describing the expected type.
Expand Down
4 changes: 1 addition & 3 deletions Sources/XMLCoder/Decoder/XMLDecoder.swift
Expand Up @@ -8,9 +8,7 @@

import Foundation

//===----------------------------------------------------------------------===//
// XML Decoder
//===----------------------------------------------------------------------===//
// MARK: - XML Decoder

/// `XMLDecoder` facilitates the decoding of XML into semantic `Decodable` types.
open class XMLDecoder {
Expand Down
4 changes: 2 additions & 2 deletions Tests/XMLCoderTests/Auxiliary/XMLElementTests.swift
Expand Up @@ -49,7 +49,7 @@ class XMLElementTests: XCTestCase {
XCTAssertEqual(keyed.elements, [element])
XCTAssertEqual(keyed.attributes, [])
}

func testWhitespaceWithNoElements_keyed() {
let keyed = XMLCoderElement(key: "foo", isStringBoxCDATA: false, box: StringBox("bar"))
XCTAssertFalse(keyed.isWhitespaceWithNoElements())
Expand Down Expand Up @@ -95,7 +95,7 @@ class XMLElementTests: XCTestCase {
<Input xmlns="https://example.com"><Nested xmlns:xsi="https://example.com" xsi:someName="nestedAttrValue"></Nested></Input>
""")
}

func testNestedElementWith_Namespace_Attribute_Element() {
typealias Attribute = XMLCoderElement.Attribute
typealias Element = XMLCoderElement
Expand Down
8 changes: 4 additions & 4 deletions Tests/XMLCoderTests/Auxiliary/XMLStackParserTests.swift
Expand Up @@ -56,7 +56,7 @@ class XMLStackParserTests: XCTestCase {
shouldProcessNamespaces: false
))
}

func testNestedMembers_removeWhitespaceElements() throws {
let parser = XMLStackParser(trimValueWhitespaces: false, removeWhitespaceElements: true)
let xmlData =
Expand Down Expand Up @@ -110,7 +110,7 @@ class XMLStackParserTests: XCTestCase {

XCTAssertEqual(root.elements[0].key, "")
XCTAssertEqual(root.elements[0].stringValue, "\n ")

XCTAssertEqual(root.elements[1].key, "nestedStringList")
XCTAssertEqual(root.elements[1].elements[0].key, "")
XCTAssertEqual(root.elements[1].elements[0].stringValue, "\n ")
Expand All @@ -127,7 +127,7 @@ class XMLStackParserTests: XCTestCase {
XCTAssertEqual(root.elements[1].elements[3].elements[3].key, "member")
XCTAssertEqual(root.elements[1].elements[3].elements[3].elements[0].stringValue, "qux")
}

func testEscapableCharacters_removeWhitespaceElements() throws {
let parser = XMLStackParser(trimValueWhitespaces: false, removeWhitespaceElements: true)
let xmlData =
Expand All @@ -142,7 +142,7 @@ class XMLStackParserTests: XCTestCase {
XCTAssertEqual(root.elements[0].key, "strValue")
XCTAssertEqual(root.elements[0].elements[0].stringValue, "escaped data: &lt;\r\n")
}

func testEscapableCharacters() throws {
let parser = XMLStackParser(trimValueWhitespaces: false, removeWhitespaceElements: false)
let xmlData =
Expand Down
4 changes: 2 additions & 2 deletions Tests/XMLCoderTests/Minimal/NestedStringList.swift
Expand Up @@ -28,10 +28,10 @@ class NestedStringList: XCTestCase {
let containerValues = try decoder.container(keyedBy: CodingKeys.self)
let nestedStringListWrappedContainer = try containerValues.nestedContainer(keyedBy: NestedMemberKeys.self, forKey: .nestedStringList)
let nestedStringListContainer = try nestedStringListWrappedContainer.decodeIfPresent([[String]].self, forKey: .member)
var nestedStringListBuffer:[[String]] = []
var nestedStringListBuffer: [[String]] = []
if let nestedStringListContainer = nestedStringListContainer {
nestedStringListBuffer = [[String]]()
var listBuffer0: [String]? = nil
var listBuffer0: [String]?
for listContainer0 in nestedStringListContainer {
listBuffer0 = [String]()
for stringContainer1 in listContainer0 {
Expand Down
3 changes: 1 addition & 2 deletions Tests/XMLCoderTests/Minimal/StringTests.swift
Expand Up @@ -16,8 +16,7 @@ class StringTests: XCTestCase {
}

let values: [(Value, String)] = [
// FIXME!
// ("", ""),
("", ""),
("false", "false"),
("-42", "-42"),
("42", "42"),
Expand Down