diff --git a/.github/workflows/VerifyChanges.yaml b/.github/workflows/VerifyChanges.yaml index 8894d0e..0d2e7aa 100644 --- a/.github/workflows/VerifyChanges.yaml +++ b/.github/workflows/VerifyChanges.yaml @@ -6,6 +6,9 @@ on: push: branches: ["main"] +env: + XCODE_VERSION: 26.0.1 + jobs: lint: name: Lint @@ -13,12 +16,10 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Select Xcode 26.0.0 - run: | - sudo xcode-select -s /Applications/Xcode_26.0.0.app + - name: Select Xcode ${{ env.XCODE_VERSION }} + run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app - name: Lint - run: | - Scripts/lint + run: Scripts/lint build-and-test: name: Build and Test (${{ matrix.platform }}) @@ -53,8 +54,8 @@ jobs: XCODE_TEST_PRODUCTS_PATH: .build/DevFoundation.xctestproducts steps: - - name: Select Xcode 26.0.0 - run: sudo xcode-select -s /Applications/Xcode_26.0.0.app + - name: Select Xcode ${{ env.XCODE_VERSION }} + run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app - name: Checkout uses: actions/checkout@v4 diff --git a/App/Tests/DevKeychainAppTests/GenericPasswordIntegrationTests.swift b/App/Tests/DevKeychainAppTests/GenericPasswordIntegrationTests.swift index 4e35e3e..e5f1be3 100644 --- a/App/Tests/DevKeychainAppTests/GenericPasswordIntegrationTests.swift +++ b/App/Tests/DevKeychainAppTests/GenericPasswordIntegrationTests.swift @@ -35,7 +35,7 @@ struct GenericPasswordIntegrationTests: RandomValueGenerating { let attributes = GenericPassword.AdditionAttributes( service: service, account: account, - data: randomData() + data: randomData(), ) let addedItem = try keychain.addItem(with: attributes) diff --git a/App/Tests/DevKeychainAppTests/InternetPasswordIntegrationTests.swift b/App/Tests/DevKeychainAppTests/InternetPasswordIntegrationTests.swift index 1afc226..ba7408a 100644 --- a/App/Tests/DevKeychainAppTests/InternetPasswordIntegrationTests.swift +++ b/App/Tests/DevKeychainAppTests/InternetPasswordIntegrationTests.swift @@ -35,7 +35,7 @@ struct InternetPasswordIntegrationTests: RandomValueGenerating { let attributes = InternetPassword.AdditionAttributes( server: server, account: account, - data: randomData() + data: randomData(), ) let addedItem = try keychain.addItem(with: attributes) diff --git a/Scripts/format b/Scripts/format new file mode 100755 index 0000000..d238184 --- /dev/null +++ b/Scripts/format @@ -0,0 +1,13 @@ +#!/bin/bash + +# Get the directory where this script is located +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +# Go to the repository root (one level up from Scripts) +REPO_ROOT="$(dirname "$SCRIPT_DIR")" + +# Run swift format with --in-place to fix formatting issues +swift format --in-place --recursive \ + "$REPO_ROOT/App/" \ + "$REPO_ROOT/Sources/" \ + "$REPO_ROOT/Tests/" diff --git a/Sources/DevKeychain/Errors/KeychainItemMappingError.swift b/Sources/DevKeychain/Errors/KeychainItemMappingError.swift index 6f4a4f9..c95e319 100644 --- a/Sources/DevKeychain/Errors/KeychainItemMappingError.swift +++ b/Sources/DevKeychain/Errors/KeychainItemMappingError.swift @@ -27,7 +27,7 @@ enum KeychainItemMappingError: Error, Equatable { return lhsAttribute == rhsAttribute case ( .attributeTypeMismatch(let lhsAttribute, let lhsType), - .attributeTypeMismatch(let rhsAttribute, let rhsType) + .attributeTypeMismatch(let rhsAttribute, let rhsType), ): return lhsAttribute == rhsAttribute && lhsType == rhsType default: diff --git a/Sources/DevKeychain/Keychain Items/GenericPassword.swift b/Sources/DevKeychain/Keychain Items/GenericPassword.swift index e1c027f..ffc834f 100644 --- a/Sources/DevKeychain/Keychain Items/GenericPassword.swift +++ b/Sources/DevKeychain/Keychain Items/GenericPassword.swift @@ -45,7 +45,7 @@ extension GenericPassword { self.init( service: try attributes.value(forKeychainAttribute: kSecAttrService, type: String.self), account: try attributes.value(forKeychainAttribute: kSecAttrAccount, type: String.self), - data: try attributes.value(forKeychainAttribute: kSecValueData, type: Data.self) + data: try attributes.value(forKeychainAttribute: kSecValueData, type: Data.self), ) } } diff --git a/Sources/DevKeychain/Keychain Items/InternetPassword.swift b/Sources/DevKeychain/Keychain Items/InternetPassword.swift index 2f942cc..d4d5c1e 100644 --- a/Sources/DevKeychain/Keychain Items/InternetPassword.swift +++ b/Sources/DevKeychain/Keychain Items/InternetPassword.swift @@ -45,7 +45,7 @@ extension InternetPassword { self.init( server: try attributes.value(forKeychainAttribute: kSecAttrServer, type: String.self), account: try attributes.value(forKeychainAttribute: kSecAttrAccount, type: String.self), - data: try attributes.value(forKeychainAttribute: kSecValueData, type: Data.self) + data: try attributes.value(forKeychainAttribute: kSecValueData, type: Data.self), ) } } diff --git a/Tests/DevKeychainTests/Keychain Items/GenericPasswordTests.swift b/Tests/DevKeychainTests/Keychain Items/GenericPasswordTests.swift index 3ba8042..b0e2c08 100644 --- a/Tests/DevKeychainTests/Keychain Items/GenericPasswordTests.swift +++ b/Tests/DevKeychainTests/Keychain Items/GenericPasswordTests.swift @@ -143,7 +143,7 @@ struct GenericPassword_AdditionAttributesTests: RandomValueGenerating { service: service, account: account, password: password, - encoding: .ascii + encoding: .ascii, ) #expect(attributes == nil) } @@ -161,7 +161,7 @@ struct GenericPassword_AdditionAttributesTests: RandomValueGenerating { service: service, account: account, password: password, - encoding: .utf8 + encoding: .utf8, ) ) @@ -198,7 +198,7 @@ struct GenericPassword_AdditionAttributesTests: RandomValueGenerating { let attributes = GenericPassword.AdditionAttributes( service: randomAlphanumericString(), account: randomAlphanumericString(), - data: randomData() + data: randomData(), ) #expect(throws: KeychainItemMappingError.dataCorrupted) { @@ -212,7 +212,7 @@ struct GenericPassword_AdditionAttributesTests: RandomValueGenerating { let attributes = GenericPassword.AdditionAttributes( service: randomAlphanumericString(), account: randomAlphanumericString(), - data: randomData() + data: randomData(), ) #expect(throws: KeychainItemMappingError.self) { @@ -273,7 +273,7 @@ struct GenericPassword_QueryTests: RandomValueGenerating { for isAccountNil in [false, true] { let query = GenericPassword.Query( service: isServiceNil ? nil : service, - account: isAccountNil ? nil : account + account: isAccountNil ? nil : account, ) var expectedDictionary = fullAttributesDictionary @@ -295,7 +295,7 @@ struct GenericPassword_QueryTests: RandomValueGenerating { mutating func returnDictionaryIsCorrect() throws { let query = GenericPassword.Query( service: randomOptional(randomAlphanumericString()), - account: randomOptional(randomAlphanumericString()) + account: randomOptional(randomAlphanumericString()), ) let expectedDictionary = [ @@ -311,7 +311,7 @@ struct GenericPassword_QueryTests: RandomValueGenerating { mutating func mapThrowsErrorWhenRawItemsIsIncorrectType() { let query = GenericPassword.Query( service: randomOptional(randomAlphanumericString()), - account: randomOptional(randomAlphanumericString()) + account: randomOptional(randomAlphanumericString()), ) #expect(throws: KeychainItemMappingError.dataCorrupted) { @@ -324,14 +324,14 @@ struct GenericPassword_QueryTests: RandomValueGenerating { mutating func mapReturnsItemsWithCorrectValues() throws { let query = GenericPassword.Query( service: randomOptional(randomAlphanumericString()), - account: randomOptional(randomAlphanumericString()) + account: randomOptional(randomAlphanumericString()), ) let expectedItems = Array(count: randomInt(in: 3 ... 5)) { GenericPassword( service: randomAlphanumericString(), account: randomAlphanumericString(), - data: randomData() + data: randomData(), ) } diff --git a/Tests/DevKeychainTests/Keychain Items/InternetPasswordTests.swift b/Tests/DevKeychainTests/Keychain Items/InternetPasswordTests.swift index 349dca6..87de407 100644 --- a/Tests/DevKeychainTests/Keychain Items/InternetPasswordTests.swift +++ b/Tests/DevKeychainTests/Keychain Items/InternetPasswordTests.swift @@ -143,7 +143,7 @@ struct InternetPassword_AdditionAttributesTests: RandomValueGenerating { server: server, account: account, password: password, - encoding: .ascii + encoding: .ascii, ) #expect(attributes == nil) } @@ -161,7 +161,7 @@ struct InternetPassword_AdditionAttributesTests: RandomValueGenerating { server: server, account: account, password: password, - encoding: .utf8 + encoding: .utf8, ) ) @@ -198,7 +198,7 @@ struct InternetPassword_AdditionAttributesTests: RandomValueGenerating { let attributes = InternetPassword.AdditionAttributes( server: randomAlphanumericString(), account: randomAlphanumericString(), - data: randomData() + data: randomData(), ) #expect(throws: KeychainItemMappingError.dataCorrupted) { @@ -212,7 +212,7 @@ struct InternetPassword_AdditionAttributesTests: RandomValueGenerating { let attributes = InternetPassword.AdditionAttributes( server: randomAlphanumericString(), account: randomAlphanumericString(), - data: randomData() + data: randomData(), ) #expect(throws: KeychainItemMappingError.self) { @@ -273,7 +273,7 @@ struct InternetPassword_QueryTests: RandomValueGenerating { for isAccountNil in [false, true] { let query = InternetPassword.Query( server: isServerNil ? nil : server, - account: isAccountNil ? nil : account + account: isAccountNil ? nil : account, ) var expectedDictionary = fullAttributesDictionary @@ -295,7 +295,7 @@ struct InternetPassword_QueryTests: RandomValueGenerating { mutating func returnDictionaryIsCorrect() throws { let query = InternetPassword.Query( server: randomOptional(randomAlphanumericString()), - account: randomOptional(randomAlphanumericString()) + account: randomOptional(randomAlphanumericString()), ) let expectedDictionary = [ @@ -311,7 +311,7 @@ struct InternetPassword_QueryTests: RandomValueGenerating { mutating func mapThrowsErrorWhenRawItemsIsIncorrectType() { let query = InternetPassword.Query( server: randomOptional(randomAlphanumericString()), - account: randomOptional(randomAlphanumericString()) + account: randomOptional(randomAlphanumericString()), ) #expect(throws: KeychainItemMappingError.dataCorrupted) { @@ -324,14 +324,14 @@ struct InternetPassword_QueryTests: RandomValueGenerating { mutating func mapReturnsItemsWithCorrectValues() throws { let query = InternetPassword.Query( server: randomOptional(randomAlphanumericString()), - account: randomOptional(randomAlphanumericString()) + account: randomOptional(randomAlphanumericString()), ) let expectedItems = Array(count: randomInt(in: 3 ... 5)) { InternetPassword( server: randomAlphanumericString(), account: randomAlphanumericString(), - data: randomData() + data: randomData(), ) } diff --git a/Tests/DevKeychainTests/Testing Helpers/RandomValueGenerating+DevKeychain.swift b/Tests/DevKeychainTests/Testing Helpers/RandomValueGenerating+DevKeychain.swift index df1e14c..626e7f3 100644 --- a/Tests/DevKeychainTests/Testing Helpers/RandomValueGenerating+DevKeychain.swift +++ b/Tests/DevKeychainTests/Testing Helpers/RandomValueGenerating+DevKeychain.swift @@ -25,7 +25,7 @@ extension RandomValueGenerating { mutating func randomKeychainQueryOptions() -> Keychain.QueryOptions { return .init( isCaseInsensitive: randomBool(), - limit: randomOptional(randomInt(in: 1 ... 10)) + limit: randomOptional(randomInt(in: 1 ... 10)), ) } }