From 86c9a95c7e377cf566de6c0ed0ff9eb627dcaba5 Mon Sep 17 00:00:00 2001 From: xiaoweii Date: Fri, 19 Jul 2024 09:22:43 +0800 Subject: [PATCH] chore: update format and lint plugin --- .swiftformat | 1 + .swiftlint.yml | 1 + Sources/Clickstream/AWSClickstreamPlugin+ClientBehavior.swift | 2 +- Tests/ClickstreamTests/Clickstream/ClickstreamEventTest.swift | 1 + Tests/ClickstreamTests/Clickstream/EventRecorderTest.swift | 2 +- 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.swiftformat b/.swiftformat index 2ab9f74..f5b95dd 100644 --- a/.swiftformat +++ b/.swiftformat @@ -35,6 +35,7 @@ --enable semicolons --semicolons never --disable sortedImports +--disable sortImports --importgrouping testable-bottom --enable spaceAroundOperators --operatorfunc spaced diff --git a/.swiftlint.yml b/.swiftlint.yml index 29287ee..ea4ccda 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -16,6 +16,7 @@ opt_in_rules: disabled_rules: - opening_brace + - non_optional_string_data_conversion # configurable rules can be customized from this configuration file closing_brace: error diff --git a/Sources/Clickstream/AWSClickstreamPlugin+ClientBehavior.swift b/Sources/Clickstream/AWSClickstreamPlugin+ClientBehavior.swift index 0288957..7f98b1b 100644 --- a/Sources/Clickstream/AWSClickstreamPlugin+ClientBehavior.swift +++ b/Sources/Clickstream/AWSClickstreamPlugin+ClientBehavior.swift @@ -69,7 +69,7 @@ extension AWSClickstreamPlugin { } func registerGlobalProperties(_ properties: AnalyticsProperties) { - properties.forEach { key, value in + for (key, value) in properties { analyticsClient.addGlobalAttribute(value, forKey: key) } } diff --git a/Tests/ClickstreamTests/Clickstream/ClickstreamEventTest.swift b/Tests/ClickstreamTests/Clickstream/ClickstreamEventTest.swift index dbb8c73..71f40fb 100644 --- a/Tests/ClickstreamTests/Clickstream/ClickstreamEventTest.swift +++ b/Tests/ClickstreamTests/Clickstream/ClickstreamEventTest.swift @@ -8,6 +8,7 @@ @testable import Clickstream import Foundation import XCTest + class ClickstreamEventTest: XCTestCase { let testAppId = "testAppId" let storage = ClickstreamContextStorage(userDefaults: UserDefaults.standard) diff --git a/Tests/ClickstreamTests/Clickstream/EventRecorderTest.swift b/Tests/ClickstreamTests/Clickstream/EventRecorderTest.swift index d4fe57c..e914dc9 100644 --- a/Tests/ClickstreamTests/Clickstream/EventRecorderTest.swift +++ b/Tests/ClickstreamTests/Clickstream/EventRecorderTest.swift @@ -182,7 +182,7 @@ class EventRecorderTest: XCTestCase { XCTAssertEqual(85.5, (userAttributes["score"] as! JsonObject)["value"] as! Double) XCTAssertEqual("carl", (userAttributes["_user_name"] as! JsonObject)["value"] as! String) } - + func testModifyGlobalUserAttributesWillNotAffectTheEventUserAttributes() throws { var userInfo = JsonObject() let currentTimeStamp = Date().millisecondsSince1970