Skip to content

Commit 325a095

Browse files
committed
refactor: static code analysis comments
Signed-off-by: Rob Walworth <[email protected]>
1 parent b9ebad1 commit 325a095

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

Sources/Hiero/Client/Client.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ public final class Client: Sendable {
256256
// Only take the plaintext nodes
257257
let filtered = NodeAddressBook(
258258
nodeAddresses: addressBook.nodeAddresses.map { address in
259-
let plaintextEndpoints = address.serviceEndpoints.filter {
260-
$0.port == NodeConnection.consensusPlaintextPort
259+
let plaintextEndpoints = address.serviceEndpoints.filter { endpoint in
260+
endpoint.port == NodeConnection.consensusPlaintextPort
261261
}
262262

263263
return NodeAddress(

Sources/Hiero/Client/ConsensusNetwork.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ internal final class ConsensusNetwork: Sendable, AtomicReference {
160160
for (index, address) in addressBook.enumerated() {
161161
// Use dictionary for O(1) port priority lookup instead of O(n) array search
162162
let endpoints = address.serviceEndpoints
163-
.sorted {
164-
Self.portPriority[$0.port] ?? Int.max < Self.portPriority[$1.port] ?? Int.max
163+
.sorted { endpoint1, endpoint2 in
164+
Self.portPriority[endpoint1.port] ?? Int.max < Self.portPriority[endpoint2.port] ?? Int.max
165165
}
166166

167167
let selected = endpoints.first.flatMap { endpoint -> HostAndPort? in

Sources/Hiero/Client/NetworkFactory.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ internal enum NetworkFactory {
3939
/// - realm: Realm number for custom networks (default: 0)
4040
/// - Returns: Configured consensus network
4141
/// - Throws: HError if network name is unknown or addresses are invalid
42-
static func makeConsensusNetwork(
42+
internal static func makeConsensusNetwork(
4343
spec: ConsensusNetworkSpecification,
4444
eventLoop: EventLoopGroup,
4545
shard: UInt64 = 0,
@@ -63,7 +63,7 @@ internal enum NetworkFactory {
6363
/// - realm: Realm number for localhost (default: 0)
6464
/// - Returns: Configured consensus network
6565
/// - Throws: HError if network name is unknown
66-
static func makeConsensusNetworkByName(
66+
internal static func makeConsensusNetworkByName(
6767
_ name: borrowing String,
6868
eventLoop: EventLoopGroup,
6969
shard: UInt64 = 0,
@@ -102,7 +102,7 @@ internal enum NetworkFactory {
102102
/// - eventLoop: Event loop group for managing connections
103103
/// - Returns: Configured mirror network, or empty mirror network if spec is nil
104104
/// - Throws: HError if network name is unknown
105-
static func makeMirrorNetwork(
105+
internal static func makeMirrorNetwork(
106106
spec: MirrorNetworkSpecification?,
107107
eventLoop: EventLoopGroup
108108
) throws -> MirrorNetwork {
@@ -128,7 +128,7 @@ internal enum NetworkFactory {
128128
/// - eventLoop: Event loop group for managing connections
129129
/// - Returns: Configured mirror network
130130
/// - Throws: HError if network name is unknown
131-
static func makeMirrorNetworkByName(
131+
internal static func makeMirrorNetworkByName(
132132
_ name: borrowing String,
133133
eventLoop: EventLoopGroup
134134
) throws -> MirrorNetwork {
@@ -157,7 +157,7 @@ internal enum NetworkFactory {
157157
///
158158
/// - Parameter name: Network name
159159
/// - Returns: Ledger ID for the network, or nil for custom/localhost networks
160-
static func ledgerIdForNetworkName(_ name: borrowing String) -> LedgerId? {
160+
internal static func ledgerIdForNetworkName(_ name: borrowing String) -> LedgerId? {
161161
switch name.lowercased() {
162162
case "mainnet":
163163
return .mainnet

Sources/Hiero/Client/NetworkSpecification.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ internal enum NetworkSpecification<Custom: Decodable>: Decodable, Sendable where
3333
///
3434
/// - Parameter decoder: The decoder to read data from
3535
/// - Throws: DecodingError if neither format can be decoded
36-
init(from decoder: Decoder) throws {
36+
internal init(from decoder: Decoder) throws {
3737
let container = try decoder.singleValueContainer()
3838

3939
// Try decoding as string (network name) first

0 commit comments

Comments
 (0)