Skip to content

Commit

Permalink
Adjust linting
Browse files Browse the repository at this point in the history
  • Loading branch information
marzvrover committed Dec 19, 2020
1 parent c2485fb commit 4bea622
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
3 changes: 2 additions & 1 deletion Sources/SwiftcraftLibrary/Networking/Packet/Packet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ extension PacketProtocol {
tmpBuffer.reserveCapacity(16) // 128 bits
let uuid = (data[def.name] as! UUID).uuid
let bytes = [uuid.0, uuid.1, uuid.2, uuid.3, uuid.4, uuid.5, uuid.6, uuid.7,
uuid.8, uuid.9, uuid.10, uuid.11, uuid.12, uuid.13, uuid.14, uuid.15,]
uuid.8, uuid.9, uuid.10, uuid.11, uuid.12, uuid.13, uuid.14, uuid.15]
// swiftlint:disable:previous trailing_comma
tmpBuffer.writeBytes(bytes)
break
case .string:
Expand Down
20 changes: 10 additions & 10 deletions Tests/SwiftcraftLibraryTests/DataTypeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import XCTest
import class Foundation.Bundle
import NIO
@testable import SwiftcraftLibrary

// swiftlint:disable trailing_comma
final class DataTypeTests: XCTestCase {
class TestPacket: Packet {
init(definition: Definition) {
Expand Down Expand Up @@ -82,7 +82,7 @@ final class DataTypeTests: XCTestCase {
var buffer = allocator.buffer(bytes: bytes)
var packet = TestPacket(definition: [(name: "bytes",
type: .byteArray,
args: ["length": bytes.count]),])
args: ["length": bytes.count])])
try! packet.decode(buffer: &buffer)
XCTAssertEqual(packet.data["bytes"] as! [UInt8], bytes)

Expand Down Expand Up @@ -126,7 +126,7 @@ final class DataTypeTests: XCTestCase {
buffer.writeInteger(x.bitPattern, as: UInt32.self)
var packet = TestPacket(definition: [(name: "data",
type: .float,
args: nil),])
args: nil)])
try! packet.decode(buffer: &buffer)

XCTAssertEqual(packet.data["data"] as! Float32, x)
Expand All @@ -147,7 +147,7 @@ final class DataTypeTests: XCTestCase {
buffer.writeInteger(x.bitPattern, as: UInt64.self)
var packet = TestPacket(definition: [(name: "data",
type: .double,
args: nil),])
args: nil)])
try! packet.decode(buffer: &buffer)

XCTAssertEqual(packet.data["data"] as! Float64, x)
Expand All @@ -171,7 +171,7 @@ final class DataTypeTests: XCTestCase {
])
var packet = TestPacket(definition: [(name: "data",
type: .uuid,
args: nil),])
args: nil)])
try! packet.decode(buffer: &buffer)

XCTAssertEqual(packet.data["data"] as! UUID, x)
Expand All @@ -195,7 +195,7 @@ final class DataTypeTests: XCTestCase {
var buffer = allocator.buffer(bytes: x.utf8)
var packet = TestPacket(definition: [(name: "data",
type: .string,
args: ["length": x.utf8.count]),])
args: ["length": x.utf8.count])])
try! packet.decode(buffer: &buffer)

XCTAssertEqual(packet.data["data"] as! String, x)
Expand All @@ -214,7 +214,7 @@ final class DataTypeTests: XCTestCase {

var packet = TestPacket(definition: [(name: "var_int",
type: .varInt,
args: nil),])
args: nil)])
try! packet.decode(buffer: &buffer)

XCTAssertEqual(packet.data["var_int"] as! Int32, Int32(varInt.value))
Expand All @@ -233,7 +233,7 @@ final class DataTypeTests: XCTestCase {

var packet = TestPacket(definition: [(name: "var_long",
type: .varLong,
args: nil),])
args: nil)])
try! packet.decode(buffer: &buffer)

XCTAssertEqual(packet.data["var_long"] as! Int64, Int64(varLong.value))
Expand All @@ -254,7 +254,7 @@ final class DataTypeTests: XCTestCase {
buffer.writeBytes(x.utf8)
var packet = TestPacket(definition: [(name: "data",
type: .varString,
args: ["length": x.utf8.count]),])
args: ["length": x.utf8.count])])
try! packet.decode(buffer: &buffer)

XCTAssertEqual(packet.data["data"] as! String, x)
Expand Down Expand Up @@ -299,7 +299,7 @@ final class DataTypeTests: XCTestCase {
args: nil),
(name: "max",
type: packetType,
args: nil),])
args: nil)])
try! packet.decode(buffer: &buffer)

XCTAssertEqual(packet.data["min"] as! T, T.min)
Expand Down

0 comments on commit 4bea622

Please sign in to comment.