Skip to content

Commit 6bc3b46

Browse files
build: fix all swiftlint errors
1 parent 4bb90db commit 6bc3b46

25 files changed

+29
-66
lines changed

.swiftlint.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,16 @@ opt_in_rules:
7171
- xct_specific_matcher
7272
- yoda_condition
7373
excluded:
74+
- .git
75+
- .swiftpm
7476
- .build
7577
- build
7678
- Pods
7779
- protobuf
7880
- PrismAPISDK
79-
- Sources/PrismSwiftSDK/protobuf
81+
- Sources/PrismSwiftSDK/protobuf/*
8082
- Tests/PrismSwiftSDKTests
81-
- Castor/Sources/DIDParser/DIDGrammar
83+
- Castor/Sources/DIDParser/DIDGrammar/*
8284
- Castor/Tests
8385
- Castor/Sources/protobuf
8486
- Apollo/Tests
@@ -90,6 +92,7 @@ excluded:
9092
- Pluto/Tests
9193
- Pollux/Tests
9294
- PrismAgent/Tests
95+
- Mercury/Sources/TestingConstants/*
9396
- Sample
9497
line_length:
9598
ignores_comments: true
@@ -121,4 +124,5 @@ identifier_name:
121124
excluded:
122125
- id
123126
- ec
127+
- to
124128
reporter: "xcode"

Castor/Sources/CastorImpl+Public.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ extension CastorImpl: Castor {
3636
}
3737

3838
public func resolveDID(did: DID) async throws -> DIDDocument {
39-
guard let document = try await resolvers.first?.resolve(did: did) else { throw CastorError.notPossibleToResolveDID }
39+
guard
40+
let document = try await resolvers
41+
.first?
42+
.resolve(did: did)
43+
else { throw CastorError.notPossibleToResolveDID }
4044
return document
4145
}
4246
}

Core/Sources/Helpers/JSONDecoder+Helper.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Foundation
22

33
public extension JSONDecoder {
44
static func didComm() -> JSONDecoder {
5-
var decoder = JSONDecoder()
5+
let decoder = JSONDecoder()
66
decoder.dataDecodingStrategy = .deferredToData
77
decoder.keyDecodingStrategy = .convertFromSnakeCase
88
return decoder

Core/Sources/Helpers/JSONEncoder+Helper.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Foundation
22

33
public extension JSONEncoder {
44
static func didComm() -> JSONEncoder {
5-
var encoder = JSONEncoder()
5+
let encoder = JSONEncoder()
66
encoder.dataEncodingStrategy = .deferredToData
77
encoder.keyEncodingStrategy = .convertToSnakeCase
88
encoder.outputFormatting = .prettyPrinted

Domain/Sources/BBs/Mercury.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ public protocol Mercury {
77
func sendMessage(msg: Message) async throws -> Data?
88
}
99

10-
extension Mercury {
11-
public func sendMessage(msg: Message) async throws -> Message? {
10+
public extension Mercury {
11+
func sendMessage(msg: Message) async throws -> Message? {
1212
guard
1313
let msgData = try await sendMessage(msg: msg),
1414
let msgStr = String(data: msgData, encoding: .utf8)

Domain/Sources/Models/Message.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ public struct Message {
44
public let id: String
55
public let piuri: String
66
public let from: DID?
7-
// swiftlint:disable identifier_name
87
public let to: DID?
9-
// swiftlint:enable identifier_name
108
public let fromPrior: String?
119
public let body: Data
1210
public let extraHeaders: [String: String]
@@ -21,9 +19,7 @@ public struct Message {
2119
id: String = UUID().uuidString,
2220
piuri: String,
2321
from: DID? = nil,
24-
// swiftlint:disable identifier_name
2522
to: DID? = nil,
26-
// swiftlint:enable identifier_name
2723
fromPrior: String? = nil,
2824
body: Data,
2925
extraHeaders: [String : String] = [:],

Pluto/Sources/Helpers/Message+Codable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ extension Message: Codable {
1717
case ack
1818
case body
1919
}
20-
20+
2121
public func encode(to encoder: Encoder) throws {
2222
var container = encoder.container(keyedBy: CodingKeys.self)
2323
try container.encode(id, forKey: .id)

Pluto/Sources/PersistentStorage/DAO/CDDIDPrivateKeyDAO+DIDPrivateKeyProvider.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ extension CDDIDPrivateKeyDAO: DIDPrivateKeyProvider {
1414
func getDIDInfo(did: DID) -> AnyPublisher<(did: DID, privateKey: PrivateKey)?, Error> {
1515
fetchByIDsPublisher(did.string, context: readContext)
1616
.map {
17-
$0.map { (DID(from: $0), PrivateKey(curve: $0.curve, value: $0.privateKey))}
18-
}
17+
$0.map { (DID(from: $0), PrivateKey(curve: $0.curve, value: $0.privateKey))
18+
}}
1919
.eraseToAnyPublisher()
2020
}
2121
func getPrivateKey(did: DID) -> AnyPublisher<PrivateKey?, Error> {
2222
fetchByIDsPublisher(did.string, context: readContext)
2323
.map { did in
24-
did.map { PrivateKey(curve: $0.curve, value: $0.privateKey) }
25-
}
24+
did.map { PrivateKey(curve: $0.curve, value: $0.privateKey)
25+
}}
2626
.eraseToAnyPublisher()
2727
}
2828
}

Pluto/Sources/PersistentStorage/DAO/CDMediatorDIDDAO+MediatorStore.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extension CDMediatorDIDDAO: MediatorStore {
2222
.eraseToAnyPublisher()
2323
}
2424
.flatMap { peerDID, routingDID, mediatorDID in
25-
updateOrCreate(peer.string, context: writeContext) { cdobj, context in
25+
updateOrCreate(peer.string, context: writeContext) { cdobj, _ in
2626
cdobj.parseFrom(peerDID: peerDID, routingDID: routingDID, mediatorDID: mediatorDID)
2727
}
2828
}

Pluto/Sources/PersistentStorage/DAO/CDMessageDAO+MessageProvider.swift

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Domain
55
extension CDMessageDAO: MessageProvider {
66
func getAll() -> AnyPublisher<[Message], Error> {
77
fetchController(context: readContext)
8-
.tryMap { try $0.map { try $0.toDomain() }}
8+
.tryMap { try $0.map { try $0.toDomain() } }
99
.eraseToAnyPublisher()
1010
}
1111

@@ -14,7 +14,7 @@ extension CDMessageDAO: MessageProvider {
1414
predicate: NSPredicate(format: "(pair.did == %@) OR (pair.holderDID.did == %@)", did.string, did.string),
1515
context: readContext
1616
)
17-
.tryMap { try $0.map { try $0.toDomain() }}
17+
.tryMap { try $0.map { try $0.toDomain() } }
1818
.eraseToAnyPublisher()
1919
}
2020

@@ -23,7 +23,7 @@ extension CDMessageDAO: MessageProvider {
2323
predicate: NSPredicate(format: "to == %@", did.string),
2424
context: readContext
2525
)
26-
.tryMap { try $0.map { try $0.toDomain() }}
26+
.tryMap { try $0.map { try $0.toDomain() } }
2727
.eraseToAnyPublisher()
2828
}
2929

@@ -32,7 +32,7 @@ extension CDMessageDAO: MessageProvider {
3232
predicate: NSPredicate(format: "from == %@", did.string),
3333
context: readContext
3434
)
35-
.tryMap { try $0.map { try $0.toDomain() }}
35+
.tryMap { try $0.map { try $0.toDomain() } }
3636
.eraseToAnyPublisher()
3737
}
3838

@@ -41,7 +41,7 @@ extension CDMessageDAO: MessageProvider {
4141
predicate: NSPredicate(format: "type == %@", type),
4242
context: readContext
4343
)
44-
.tryMap { try $0.map { try $0.toDomain() }}
44+
.tryMap { try $0.map { try $0.toDomain() } }
4545
.eraseToAnyPublisher()
4646
}
4747

@@ -50,7 +50,7 @@ extension CDMessageDAO: MessageProvider {
5050
predicate: NSPredicate(format: "(from == %@) OR (to == %@)", from.string, to.string),
5151
context: readContext
5252
)
53-
.tryMap { try $0.map { try $0.toDomain() }}
53+
.tryMap { try $0.map { try $0.toDomain() } }
5454
.eraseToAnyPublisher()
5555
}
5656

@@ -62,7 +62,6 @@ extension CDMessageDAO: MessageProvider {
6262
}
6363

6464
private extension CDMessage {
65-
6665
func toDomain() throws -> Message {
6766
return try JSONDecoder().decode(Message.self, from: dataJson)
6867
}

Pluto/Sources/PersistentStorage/DAO/CDMessageDAO+MessageStore.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ extension CDMessageDAO: MessageStore {
5252
}
5353

5454
private extension CDMessage {
55-
5655
func fromDomain(msg: Message, pair: CDDIDPair?) throws {
5756
self.messageId = msg.id
5857
self.from = msg.from?.string

Pluto/Sources/PersistentStorage/Models/CDDID+CoreDataClass.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import Domain
21
import CoreData
2+
import Domain
33
import Foundation
44

55
@objc(CDDID)

Pollux/Sources/PolluxImpl.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import Domain
22

33
public struct PolluxImpl {
4-
54
let castor: Castor
65

76
init(castor: Castor) {

PrismAgent/Sources/PrismAgent.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import Domain
44
import Foundation
55

66
public class PrismAgent {
7-
87
public enum State {
98
case stoped
109
case starting
1110
case running
1211
case stoping
1312
}
13+
1414
public enum DIDType {
1515
case prism
1616
case peer

PrismAgent/Sources/Protocols/Connection/HandshakeRequest.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ struct HandshakeRequest {
2222
let type: String = ProtocolTypes.didcommconnectionRequest.rawValue
2323
let id: String
2424
let from: DID
25-
// swiftlint:disable identifier_name
2625
let to: DID
27-
// swiftlint:enable identifier_name
2826
let thid: String?
2927
let body: Body
3028

@@ -37,9 +35,7 @@ struct HandshakeRequest {
3735
init(
3836
id: String = UUID().uuidString,
3937
from: DID,
40-
// swiftlint:disable identifier_name
4138
to: DID,
42-
// swiftlint:enable identifier_name
4339
thid: String?,
4440
body: Body
4541
) {

PrismAgent/Sources/Protocols/IssueCredential/IssueCredential.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,15 @@ public struct IssueCredential {
3333
let attachments: [AttachmentDescriptor]
3434
public let thid: String?
3535
public let from: DID
36-
// swiftlint:disable identifier_name
3736
public let to: DID
38-
// swiftlint:enable identifier_name
3937

4038
init(
4139
id: String = UUID().uuidString,
4240
body: Body,
4341
attachments: [AttachmentDescriptor],
4442
thid: String?,
4543
from: DID,
46-
// swiftlint:disable identifier_name
4744
to: DID
48-
// swiftlint:enable identifier_name
4945
) {
5046
self.id = id
5147
self.body = body

PrismAgent/Sources/Protocols/IssueCredential/OfferCredential.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,15 @@ public struct OfferCredential {
3636
let attachments: [AttachmentDescriptor]
3737
public let thid: String?
3838
public let from: DID
39-
// swiftlint:disable identifier_name
4039
public let to: DID
41-
// swiftlint:enable identifier_name
4240

4341
init(
4442
id: String = UUID().uuidString,
4543
body: Body,
4644
attachments: [AttachmentDescriptor],
4745
thid: String?,
4846
from: DID,
49-
// swiftlint:disable identifier_name
5047
to: DID
51-
// swiftlint:enable identifier_name
5248
) {
5349
self.id = id
5450
self.body = body

PrismAgent/Sources/Protocols/IssueCredential/ProposeCredential.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,15 @@ public struct ProposeCredential {
3030
let attachments: [AttachmentDescriptor]
3131
public let thid: String?
3232
public let from: DID
33-
// swiftlint:disable identifier_name
3433
public let to: DID
35-
// swiftlint:enable identifier_name
3634

3735
init(
3836
id: String = UUID().uuidString,
3937
body: Body,
4038
attachments: [AttachmentDescriptor],
4139
thid: String?,
4240
from: DID,
43-
// swiftlint:disable identifier_name
4441
to: DID
45-
// swiftlint:enable identifier_name
4642
) {
4743
self.id = id
4844
self.body = body

PrismAgent/Sources/Protocols/IssueCredential/RequestCredential.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,15 @@ public struct RequestCredential {
2727
let attachments: [AttachmentDescriptor]
2828
public let thid: String?
2929
public let from: DID
30-
// swiftlint:disable identifier_name
3130
public let to: DID
32-
// swiftlint:enable identifier_name
3331

3432
init(
3533
id: String = UUID().uuidString,
3634
body: Body,
3735
attachments: [AttachmentDescriptor],
3836
thid: String?,
3937
from: DID,
40-
// swiftlint:disable identifier_name
4138
to: DID
42-
// swiftlint:enable identifier_name
4339
) {
4440
self.id = id
4541
self.body = body

PrismAgent/Sources/Protocols/Mediation/MediationGrant.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ struct MediationGrant {
99
let id: String
1010
let type = ProtocolTypes.didcommMediationGrant.rawValue
1111
let from: DID
12-
// swiftlint:disable identifier_name
1312
let to: DID
14-
// swiftlint:enable identifier_name
1513
let body: Body
1614

1715
init(

PrismAgent/Sources/Protocols/Mediation/MediationRequest.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ struct MediationRequest {
55
let id: String
66
let type = ProtocolTypes.didcommMediationRequest.rawValue
77
let from: DID
8-
// swiftlint:disable identifier_name
98
let to: DID
10-
// swiftlint:enable identifier_name
119

1210
init(
1311
id: String = UUID().uuidString,

PrismAgent/Sources/Protocols/Pickup/PickupRequest.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ struct PickUpRequest {
1717
}
1818

1919
let from: DID
20-
// swiftlint:disable identifier_name
2120
let to: DID
22-
// swiftlint:enable identifier_name
2321
let body: Body
2422

2523
func makeMessage() throws -> Message {

PrismAgent/Sources/Protocols/ProofPresentation/Presentation.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,15 @@ public struct Presentation {
3232
let attachments: [AttachmentDescriptor]
3333
public let thid: String?
3434
public let from: DID
35-
// swiftlint:disable identifier_name
3635
public let to: DID
37-
// swiftlint:enable identifier_name
3836

3937
init(
4038
id: String = UUID().uuidString,
4139
body: Body,
4240
attachments: [AttachmentDescriptor],
4341
thid: String?,
4442
from: DID,
45-
// swiftlint:disable identifier_name
4643
to: DID
47-
// swiftlint:enable identifier_name
4844
) {
4945
self.id = id
5046
self.body = body

0 commit comments

Comments
 (0)