Skip to content

Commit

Permalink
fixing CI
Browse files Browse the repository at this point in the history
  • Loading branch information
leogdion committed Oct 9, 2024
1 parent 1e7ed39 commit f6f383d
Show file tree
Hide file tree
Showing 98 changed files with 666 additions and 463 deletions.
2 changes: 1 addition & 1 deletion .swift-format
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"prioritizeKeepingFunctionOutputTogether" : false,
"respectsExistingLineBreaks" : true,
"rules" : {
"AllPublicDeclarationsHaveDocumentation" : true,
"AllPublicDeclarationsHaveDocumentation" : false,
"AlwaysUseLiteralForEmptyCollectionInit" : false,
"AlwaysUseLowerCamelCase" : true,
"AmbiguousTrailingClosureOverload" : true,
Expand Down
6 changes: 4 additions & 2 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ opt_in_rules:
- empty_xctest_method
- enum_case_associated_values_count
- expiring_todo
# - explicit_acl
- explicit_acl
- explicit_init
- explicit_top_level_acl
# - fallthrough
Expand Down Expand Up @@ -126,4 +126,6 @@ disabled_rules:
- nesting
- implicit_getter
- switch_case_alignment
- closure_parameter_position
- closure_parameter_position
- trailing_comma
- opening_brace
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public enum DocumentTypeFilterOption: Int, CaseIterable, Identifiable, Localizab

public static let localizedStringIDMapping: [Self: String] = [
.machinesOnly: "settingsFilterRecentDocumentsMachinesOnly",
.machinesAndLibraries: "settingsFilterRecentDocumentsNone"
.machinesAndLibraries: "settingsFilterRecentDocumentsNone",
]

public var tag: Int {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public struct EnvironmentConfiguration: CustomReflectable, Sendable {
"disableAssertionFailureForError": disableAssertionFailureForError,
"disallowDatabaseRebuild": disallowDatabaseRebuild,
"onboardingOveride": onboardingOveride,
"resetApplication": resetApplication
"resetApplication": resetApplication,
]
)
}
Expand Down
3 changes: 2 additions & 1 deletion Sources/BushelCore/Foundation/ImageMetadata.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public struct ImageMetadata: Codable,
CustomDebugStringConvertible,
Hashable,
OperatingSystemInstalled,
Sendable {
Sendable
{
/// Indicates whether the image format is supported by the system.
public let isImageSupported: Bool
/// The build version associated with the image, if available.
Expand Down
2 changes: 1 addition & 1 deletion Sources/BushelCore/Foundation/Initialization.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public final class Initialization {
}
}

func execute(_ closure: @MainActor @Sendable @escaping () -> Void) {
internal func execute(_ closure: @MainActor @Sendable @escaping () -> Void) {
guard !isCompleted else {
return
}
Expand Down
3 changes: 2 additions & 1 deletion Sources/BushelCore/Foundation/PrereleaseLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ extension PrereleaseLabel {
}

public func offset(fromBuildNumber buildNumber: Int, additionalOffset: Int, factorOf factor: Int)
-> Int {
-> Int
{
(buildNumber - baseNumber + additionalOffset) / factor
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public enum SessionCloseButtonActionOption: Int, CaseIterable, Localizable, Send
public static let defaultLocalizedStringID = "settingsSessionCloseAskUser"
public static let localizedStringIDMapping: [Self: String] = [
.forceTurnOff: "settingsSessionCloseForceTurnOff",
.saveSnapshotAndForceTurnOff: "settingsSessionCloseSaveSnapshotTurnOff"
.saveSnapshotAndForceTurnOff: "settingsSessionCloseSaveSnapshotTurnOff",
]
}

Expand Down
3 changes: 2 additions & 1 deletion Sources/BushelCore/Foundation/SnapshotterID.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public struct SnapshotterID: ExpressibleByStringInterpolation,
Hashable,
RawRepresentable,
CustomStringConvertible,
Sendable {
Sendable
{
public typealias StringLiteralType = String

public static let fileVersion: SnapshotterID = "fileVersion"
Expand Down
3 changes: 2 additions & 1 deletion Sources/BushelCore/Foundation/VMSystemID.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
import Foundation

public struct VMSystemID: ExpressibleByStringInterpolation, Codable, Hashable, RawRepresentable,
Sendable {
Sendable
{
public typealias StringLiteralType = String

public let rawValue: String
Expand Down
7 changes: 4 additions & 3 deletions Sources/BushelCore/Foundation/Version.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public struct Version: CustomStringConvertible, Sendable {
public let prereleaseLabel: PrereleaseLabel?

/// Creates a new `Version` instance with the provided components.
internal init(marketingSemVer: Semver, buildNumber: Int, prereleaseLabel: PrereleaseLabel? = nil) {
internal init(marketingSemVer: Semver, buildNumber: Int, prereleaseLabel: PrereleaseLabel? = nil)
{
self.marketingSemVer = marketingSemVer
self.buildNumber = buildNumber
self.prereleaseLabel = prereleaseLabel
Expand All @@ -70,7 +71,7 @@ public struct Version: CustomStringConvertible, Sendable {

extension Version {
#if canImport(os)
public nonisolated(unsafe) static let logger: Logger = .init(
public static let logger: Logger = .init(
subsystem: Bundle.main.bundleIdentifier ?? "Bushel",
category: "application"
)
Expand All @@ -83,7 +84,7 @@ extension Version {
}

return
// swiftlint:disable:next line_length
// swiftlint:disable:next line_length
"\(self.marketingSemVer) \(prereleaseLabel.label) \(prereleaseLabel.offset(fromBuildNumber: buildNumber, additionalOffset: 1, factorOf: 2))"
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/BushelCore/Utilities/Extensions/FileManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ extension Error where Self == NSError {
code: NSFileNoSuchFileError,
userInfo: [
NSFilePathErrorKey: url.path,
NSUnderlyingErrorKey: POSIXError(.ENOENT)
NSUnderlyingErrorKey: POSIXError(.ENOENT),
]
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
}

#warning(
// swiftlint:disable:next line_length
// swiftlint:disable:next line_length
"logging-note: I wanted to note that I used to log every init while developing, just to make sure I am not leaving any leaks behind me, but not sure if this is useful for the current state of bushel development"
)
deinit {
Expand Down
3 changes: 2 additions & 1 deletion Sources/BushelCore/Utilities/Extensions/KVObservation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@

for index in 0..<Int(count) {
if let property = properties?[index],
let propertyName = String(utf8String: property_getName(property)) {
let propertyName = String(utf8String: property_getName(property))
{
propertyKeys.append(propertyName)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ extension OperatingSystemVersion {
12: "Monterey",
13: "Ventura",
14: "Sonoma",
15: "Sequoia"
15: "Sequoia",
]

private static let minimumVirtualizationMajorVersion = 12
Expand Down
2 changes: 1 addition & 1 deletion Sources/BushelCore/Utilities/Extensions/URL+Tilde.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public import Foundation
/// - Author: Jia Chen
/// - Parameter abbreviatedPath: a `String` path, abbreviated with ~
/// - Returns: The `URL` if it is able to expand the ~ into a full URL, or `nil` if it is unable do so
static func expandingTilde(from abbreviatedPath: String) -> URL? {
internal static func expandingTilde(from abbreviatedPath: String) -> URL? {
guard abbreviatedPath.first == "~" else {
return nil
}
Expand Down
3 changes: 2 additions & 1 deletion Sources/BushelCore/Utilities/Extensions/URL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ extension URL {

#if !os(Linux)
public init(resolvingSecurityScopeBookmarkData data: Data, bookmarkDataIsStale: inout Bool)
throws {
throws
{
#if os(macOS)
try self.init(
resolvingBookmarkData: data,
Expand Down
1 change: 1 addition & 0 deletions Sources/BushelCore/Utilities/IPv6Address.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
//

import Foundation

// swiftlint:disable all
public typealias IPv6Address = UInt128

Expand Down
9 changes: 6 additions & 3 deletions Sources/BushelCore/Utilities/UInt128.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ public struct UInt128 {

// MARK: - FixedWidthInteger Conformance

// swiftlint:disable all
// swift-format-ignore
extension UInt128: FixedWidthInteger {
// MARK: Instance Properties

Expand Down Expand Up @@ -640,7 +642,7 @@ extension UInt128: ExpressibleByIntegerLiteral {
}

// MARK: - CustomStringConvertible Conformance

// swift-format-ignore
extension UInt128: CustomStringConvertible {
// MARK: Instance Properties

Expand Down Expand Up @@ -725,7 +727,8 @@ extension UInt128: Comparable {
if lhs.value.upperBits < rhs.value.upperBits {
return true
} else if lhs.value.upperBits == rhs.value.upperBits,
lhs.value.lowerBits < rhs.value.lowerBits {
lhs.value.lowerBits < rhs.value.lowerBits
{
return true
}
return false
Expand Down Expand Up @@ -825,7 +828,7 @@ extension String {
self = value._valueToString(radix: radix, uppercase: uppercase)
}
}

// swift-format-ignore
extension UInt128 {
static func _valueFromString(_ value: String) -> UInt128? {
let radix = UInt128._determineRadixFromString(value)
Expand Down
9 changes: 5 additions & 4 deletions Sources/BushelCoreWax/Fake/MockDataSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ private let machineIdentifierFormatString = """
"""

package struct MockDataSet: VirtualizationDataSet {
enum Error: Swift.Error {
internal enum Error: Swift.Error {
case notSupportedKeyPath
case missingDataForString
}

let machineIdentifierData: Data
let hardwareModelData: Data
internal let machineIdentifierData: Data
internal let hardwareModelData: Data

package init(
machineIdentifier: MachineIdentifier,
Expand Down Expand Up @@ -116,7 +116,8 @@ package struct MockDataSet: VirtualizationDataSet {
}

package func data(from name: KeyPath<any BushelCore.VirtualizationData.Paths, String>) throws
-> Data {
-> Data
{
switch name {
case \.hardwareModelFileName:
hardwareModelData
Expand Down
2 changes: 1 addition & 1 deletion Sources/BushelCoreWax/Fake/URL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public import Foundation

extension URL {
// swiftlint:disable:next force_unwrapping
public static let bushelappURL: URL = .init(string: "https://getbushel.app")!
public static let bushelWebSite = URL(string: "https://getbushel.app")!
// swiftlint:disable:next force_unwrapping
public static let homeDirectory = URL(string: NSHomeDirectory())!
// swiftlint:disable:next force_unwrapping
Expand Down
2 changes: 1 addition & 1 deletion Sources/BushelCoreWax/Fake/UUID.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ extension UUID {

public static let bookmarkIDSample: Self = .init(
uuidString: "C90C2C17-7CA1-466C-93C0-D73591D65C94"
// swiftlint:disable:next force_unwrapping
// swiftlint:disable:next force_unwrapping
)!
}
4 changes: 1 addition & 3 deletions Sources/BushelCoreWax/Fake/VMSystemID.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,4 @@
public import BushelCore
import Foundation

extension VMSystemID {
public static let sampleVMSystemID: Self = .init(stringLiteral: "sample")
}
extension VMSystemID { public static let sample: Self = .init(stringLiteral: "sample") }
2 changes: 1 addition & 1 deletion Sources/BushelFactory/CalculationParameters.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ internal struct SpecificationCalculationParameters: CalculationParameters {
)
}

func indexFor(value: Int) -> Int {
internal func indexFor(value: Int) -> Int {
indexForValue(value)
}
}
Expand Down
1 change: 1 addition & 0 deletions Sources/BushelGuestProfile/DataType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public protocol SystemProfileType: Decodable {
static var dataType: DataType { get }
}

// swift-format-ignore: AlwaysUseLowerCamelCase
public enum DataType: String {
case SPParallelATADataType
case SPUniversalAccessDataType
Expand Down
9 changes: 4 additions & 5 deletions Sources/BushelHubIPSW/Sequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@ import BushelLogging

extension Sequence {
public func tryCompactMap<T>(logger: Logger? = nil, _ transform: (Self.Element) throws -> T)
-> [T] {
self.compactMap { element in
do {
return try transform(element)
} catch {
-> [T]
{
compactMap { element in
do { return try transform(element) } catch {
assertionFailure(error: error)
logger?.error("Unable to transform element: \(error.localizedDescription)")
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/BushelLibrary/LibraryError+Details.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ extension LibraryError {
return "Unable to resolve new image: \(error)"
case let .accessDeniedLibraryAt(at: path):
let components: [String?] = [
"There's an issue getting access to library at \(path)", error?.localizedDescription
"There's an issue getting access to library at \(path)", error?.localizedDescription,
]
return components.compactMap { $0 }.joined(separator: ": ")
case let .imageCorruptedAt(at: importingURL):
Expand Down
5 changes: 2 additions & 3 deletions Sources/BushelLibrary/LibraryError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,8 @@ extension LibraryError {
LibraryError(details: .imageFolderInitializationAt(url), innerError: error)
}

public static func missingInitializedProperty(_ property: InitializationProperty) -> LibraryError {
LibraryError(details: .missingInitialization(for: property))
}
public static func missingInitializedProperty(_ property: InitializationProperty) -> LibraryError
{ LibraryError(details: .missingInitialization(for: property)) }

public static func metadataUpdateError(_ error: any Error, at url: URL) -> LibraryError {
LibraryError(details: .updateMetadataAt(url), innerError: error)
Expand Down
18 changes: 3 additions & 15 deletions Sources/BushelLibrary/LibraryImageFile+Previews.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,8 @@ import Foundation

extension LibraryImageFile {
public static let preview: [LibraryImageFile] = [
.init(
id: .init(),
metadata: .Previews.venturaBeta3,
name: "macOS Monterey 12.4.0"
),
.init(
id: .init(),
metadata: .Previews.monterey,
name: "macOS Ventura 13.0.0"
),
.init(
id: .init(),
metadata: .Previews.monterey,
name: "macOS Ventura 13.4.0"
)
.init(id: .init(), metadata: .Previews.venturaBeta3, name: "macOS Monterey 12.4.0"),
.init(id: .init(), metadata: .Previews.monterey, name: "macOS Ventura 13.0.0"),
.init(id: .init(), metadata: .Previews.monterey, name: "macOS Ventura 13.4.0"),
]
}
3 changes: 2 additions & 1 deletion Sources/BushelLibrary/LibrarySystemManaging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ extension LibrarySystemManaging {

@Sendable
public func labelForSystem(_ id: VMSystemID, metadata: any OperatingSystemInstalled)
-> MetadataLabel {
-> MetadataLabel
{
let system = self.resolve(id)
return system.label(fromMetadata: metadata)
}
Expand Down
Loading

0 comments on commit f6f383d

Please sign in to comment.