Skip to content

Commit abfda49

Browse files
authored
Bump Swiftlint version, fix violations, adding missing docs (#39)
1 parent af21742 commit abfda49

File tree

6 files changed

+15
-7
lines changed

6 files changed

+15
-7
lines changed

.evergreen/install-tools.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ swiftenv local $SWIFT_VERSION
3939

4040
if [ $1 == "swiftlint" ]
4141
then
42-
build_from_gh swiftlint https://github.com/realm/SwiftLint "0.39.2"
42+
build_from_gh swiftlint https://github.com/realm/SwiftLint "0.40.0"
4343
elif [ $1 == "swiftformat" ]
4444
then
4545
build_from_gh swiftformat https://github.com/nicklockwood/SwiftFormat "0.44.13"

Sources/BSON/BSONDecimal128.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ internal struct UInt128: Equatable, Hashable {
118118
}
119119
}
120120

121+
/// A struct to represent the BSON Decimal128 type.
121122
public struct BSONDecimal128: Equatable, Hashable, CustomStringConvertible {
122123
// swiftlint:disable line_length
123124
private static let digitsRegex = #"(?:\d+)"#
@@ -182,6 +183,8 @@ public struct BSONDecimal128: Equatable, Hashable, CustomStringConvertible {
182183
self.value = value
183184
}
184185

186+
/// Initializes a new `BSONDecimal128` from the input string.
187+
/// - Throws: `BSONError.InvalidArgumentError` if the input is not a valid Decimal128 string.
185188
public init(_ data: String) throws {
186189
// swiftlint:disable:previous cyclomatic_complexity
187190
let regex = try NSRegularExpression(

Sources/BSON/BSONDocumentIterator.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import Foundation
22
import NIO
33

4+
/// Iterator over a `BSONDocument`. This type is not meant to be used directly; please use `Sequence` protocol methods
5+
/// instead.
46
public struct BSONDocumentIterator: IteratorProtocol {
57
/// The buffer we are iterating over.
68
private var buffer: ByteBuffer

Sources/BSON/BSONTimestamp.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import NIO
22

3+
/// A struct to represent the BSON Timestamp type. This type is for internal MongoDB use. For most cases, in
4+
/// application development, you should use the BSON date type (represented in this library by `Date`.)
5+
/// - SeeAlso: https://docs.mongodb.com/manual/reference/bson-types/#timestamps
36
public struct BSONTimestamp: BSONValue, Equatable, Hashable {
47
internal static var bsonType: BSONType { .timestamp }
58
internal var bson: BSON { .timestamp(self) }

Sources/BSON/Integers+BSONValue.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ extension Int32: BSONValue {
4545
}
4646

4747
/// Converts this `Int32` to a corresponding `JSON` in relaxed extendedJSON format.
48-
func toRelaxedExtendedJSON() -> JSON {
48+
internal func toRelaxedExtendedJSON() -> JSON {
4949
.number(Double(self))
5050
}
5151

5252
/// Converts this `Int32` to a corresponding `JSON` in canonical extendedJSON format.
53-
func toCanonicalExtendedJSON() -> JSON {
53+
internal func toCanonicalExtendedJSON() -> JSON {
5454
["$numberInt": .string(String(describing: self))]
5555
}
5656

@@ -115,12 +115,12 @@ extension Int64: BSONValue {
115115
}
116116

117117
/// Converts this `Int64` to a corresponding `JSON` in relaxed extendedJSON format.
118-
func toRelaxedExtendedJSON() -> JSON {
118+
internal func toRelaxedExtendedJSON() -> JSON {
119119
.number(Double(self))
120120
}
121121

122122
/// Converts this `Int64` to a corresponding `JSON` in canonical extendedJSON format.
123-
func toCanonicalExtendedJSON() -> JSON {
123+
internal func toCanonicalExtendedJSON() -> JSON {
124124
["$numberLong": .string(String(describing: self))]
125125
}
126126

Sources/BSON/String+BSONValue.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ extension String: BSONValue {
2222
}
2323

2424
/// Converts this `String` to a corresponding `JSON` in relaxed extendedJSON format.
25-
func toRelaxedExtendedJSON() -> JSON {
25+
internal func toRelaxedExtendedJSON() -> JSON {
2626
self.toCanonicalExtendedJSON()
2727
}
2828

2929
/// Converts this `String` to a corresponding `JSON` in canonical extendedJSON format.
30-
func toCanonicalExtendedJSON() -> JSON {
30+
internal func toCanonicalExtendedJSON() -> JSON {
3131
.string(self)
3232
}
3333

0 commit comments

Comments
 (0)