mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 02:25:20 +00:00
Burn down SwiftLint advisory violations from 109 to 4 (#1362)
Mechanical style fixes across the enabled rule set, mostly via swiftlint --fix (trailing_comma, comma, colon, trailing_newline, comment_spacing, unused_closure_parameter, unneeded_break_in_switch, opening_brace) plus hand fixes: - non_optional_string_data_conversion (45): .data(using: .utf8)! and ?? Data() fallbacks replaced with the non-optional Data(_.utf8), including two production sites (NIP-44 HKDF info constant and the announce canonicalization context/nickname bytes — byte-identical output, only the impossible-nil handling is gone). - switch_case_alignment: LocationChannel had a misindented closing brace; also repaired an --fix artifact in BLEService's .none case. - redundant_string_enum_value: TrustLevel raw values equal to the case names (encoded form unchanged). - unused_optional_binding: let _ = binds replaced with != nil / is Bool. - static_over_final_class: PreviewView.layerClass. - Resolved the BinaryProtocolTests TODO by documenting that 8-byte recipient ID truncation is the fixed wire-field size, not a bug. The 4 remaining violations are all todo markers for a shared test-helpers module (tracked in #1088) and one Reuse note. Co-authored-by: jack <jackjackbits@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
jack
Claude Fable 5
parent
0f26a27980
commit
b31a63ce37
@@ -174,7 +174,7 @@ struct IntegrationTests {
|
||||
}
|
||||
|
||||
// Encrypted path: use NoiseSessionManager explicitly
|
||||
let plaintext = "Encrypted message".data(using: .utf8)!
|
||||
let plaintext = Data("Encrypted message".utf8)
|
||||
let ciphertext = try helper.noiseManagers["Alice"]!.encrypt(plaintext, for: helper.nodes["Bob"]!.peerID)
|
||||
|
||||
helper.nodes["Bob"]!.packetDeliveryHandler = { packet in
|
||||
@@ -206,7 +206,7 @@ struct IntegrationTests {
|
||||
|
||||
try await confirmation("Messages delivered despite churn", expectedCount: totalMessages) { completion in
|
||||
// David tracks received messages
|
||||
helper.nodes["David"]!.messageDeliveryHandler = { message in
|
||||
helper.nodes["David"]!.messageDeliveryHandler = { _ in
|
||||
completion()
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ struct IntegrationTests {
|
||||
}
|
||||
|
||||
do {
|
||||
let plaintext = "After restart success".data(using: .utf8)!
|
||||
let plaintext = Data("After restart success".utf8)
|
||||
let ciphertext = try helper.noiseManagers["Bob"]!.encrypt(plaintext, for: helper.nodes["Alice"]!.peerID)
|
||||
let packet = TestHelpers.createTestPacket(type: MessageType.noiseEncrypted.rawValue, payload: ciphertext)
|
||||
helper.nodes["Alice"]!.packetDeliveryHandler = { pkt in
|
||||
|
||||
@@ -121,4 +121,3 @@ final class TestNetworkHelper {
|
||||
_ = try manager2.handleIncomingHandshake(from: peer1ID, message: msg3)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user