Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions .github/workflows/VerifyChanges.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@ on:
push:
branches: ["main"]

env:
XCODE_VERSION: 26.0.1

jobs:
lint:
name: Lint
runs-on: macos-15
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 }})
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 13 additions & 0 deletions Scripts/format
Original file line number Diff line number Diff line change
@@ -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/"
2 changes: 1 addition & 1 deletion Sources/DevKeychain/Errors/KeychainItemMappingError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion Sources/DevKeychain/Keychain Items/GenericPassword.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/DevKeychain/Keychain Items/InternetPassword.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
}
}
Expand Down
18 changes: 9 additions & 9 deletions Tests/DevKeychainTests/Keychain Items/GenericPasswordTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ struct GenericPassword_AdditionAttributesTests: RandomValueGenerating {
service: service,
account: account,
password: password,
encoding: .ascii
encoding: .ascii,
)
#expect(attributes == nil)
}
Expand All @@ -161,7 +161,7 @@ struct GenericPassword_AdditionAttributesTests: RandomValueGenerating {
service: service,
account: account,
password: password,
encoding: .utf8
encoding: .utf8,
)
)

Expand Down Expand Up @@ -198,7 +198,7 @@ struct GenericPassword_AdditionAttributesTests: RandomValueGenerating {
let attributes = GenericPassword.AdditionAttributes(
service: randomAlphanumericString(),
account: randomAlphanumericString(),
data: randomData()
data: randomData(),
)

#expect(throws: KeychainItemMappingError.dataCorrupted) {
Expand All @@ -212,7 +212,7 @@ struct GenericPassword_AdditionAttributesTests: RandomValueGenerating {
let attributes = GenericPassword.AdditionAttributes(
service: randomAlphanumericString(),
account: randomAlphanumericString(),
data: randomData()
data: randomData(),
)

#expect(throws: KeychainItemMappingError.self) {
Expand Down Expand Up @@ -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
Expand All @@ -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 = [
Expand All @@ -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) {
Expand All @@ -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(),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ struct InternetPassword_AdditionAttributesTests: RandomValueGenerating {
server: server,
account: account,
password: password,
encoding: .ascii
encoding: .ascii,
)
#expect(attributes == nil)
}
Expand All @@ -161,7 +161,7 @@ struct InternetPassword_AdditionAttributesTests: RandomValueGenerating {
server: server,
account: account,
password: password,
encoding: .utf8
encoding: .utf8,
)
)

Expand Down Expand Up @@ -198,7 +198,7 @@ struct InternetPassword_AdditionAttributesTests: RandomValueGenerating {
let attributes = InternetPassword.AdditionAttributes(
server: randomAlphanumericString(),
account: randomAlphanumericString(),
data: randomData()
data: randomData(),
)

#expect(throws: KeychainItemMappingError.dataCorrupted) {
Expand All @@ -212,7 +212,7 @@ struct InternetPassword_AdditionAttributesTests: RandomValueGenerating {
let attributes = InternetPassword.AdditionAttributes(
server: randomAlphanumericString(),
account: randomAlphanumericString(),
data: randomData()
data: randomData(),
)

#expect(throws: KeychainItemMappingError.self) {
Expand Down Expand Up @@ -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
Expand All @@ -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 = [
Expand All @@ -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) {
Expand All @@ -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(),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
)
}
}
Loading