Skip to content

Commit 389a51f

Browse files
committed
fixing more linting issues
1 parent 9d0cfb7 commit 389a51f

File tree

9 files changed

+61
-61
lines changed

9 files changed

+61
-61
lines changed

.swiftlint.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,5 @@ disabled_rules:
131131
- switch_case_alignment
132132
- closure_parameter_position
133133
- trailing_comma
134-
- opening_brace
134+
- opening_brace
135+
- pattern_matching_keywords

Sources/PackageDSLKit/Extensions/URL.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@
3030
package import Foundation
3131

3232
extension URL {
33-
package func polyfill() -> Polyfill {
34-
Polyfill(url: self)
35-
}
36-
3733
package struct Polyfill: Sendable {
3834
private let url: URL
3935

@@ -68,4 +64,7 @@ extension URL {
6864
}
6965
}
7066
}
67+
package func polyfill() -> Polyfill {
68+
Polyfill(url: self)
69+
}
7170
}

Sources/PackageDSLKit/Types/ComponentWriter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import SyntaxKit
3131

3232
internal struct ComponentWriter: Sendable, StructureWriter {
3333
/// Creates a struct using SyntaxKit
34-
func syntaxKitNode(from component: Component) -> Struct {
34+
internal func syntaxKitNode(from component: Component) -> Struct {
3535
// Convert properties to SyntaxKit CodeBlocks
3636
let properties: [CodeBlock] = component.properties.values.map { property in
3737
PropertyWriter.syntaxKitNode(from: property)

Sources/SwiftPackageManagerKit/Execution/Executor.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ public import Foundation
3131

3232
/// Executor for Swift Package Manager commands
3333
public struct Executor: Sendable {
34-
/// The package directory
35-
public let packageDirectory: URL
36-
37-
/// Default timeout for SPM commands (in seconds)
38-
public let defaultTimeout: TimeInterval
39-
4034
/// Closure type for executing Swift commands
4135
public typealias SwiftCommandExecutor = @Sendable (
4236
_ arguments: [String],
4337
_ workingDirectory: URL?,
4438
_ timeout: TimeInterval
4539
) async throws -> ProcessResult
4640

41+
/// The package directory
42+
public let packageDirectory: URL
43+
44+
/// Default timeout for SPM commands (in seconds)
45+
public let defaultTimeout: TimeInterval
46+
4747
/// The Swift command executor
4848
private let swiftExecutor: SwiftCommandExecutor
4949

Sources/package/Commands/Initialize.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ import PackageDSLKit
3333

3434
extension Package {
3535
internal struct Initialize: ParsableCommand, Sendable {
36+
internal static let configuration: CommandConfiguration = .init(
37+
commandName: "init"
38+
)
3639
@OptionGroup internal var settings: Settings
3740

3841
@Option
@@ -48,10 +51,6 @@ extension Package {
4851
self.settings.path != nil
4952
}
5053

51-
internal static let configuration: CommandConfiguration = .init(
52-
commandName: "init"
53-
)
54-
5554
internal func run() throws {
5655
if shouldCreateDirectory {
5756
try self.settings.fileManager.createDirectory(

Tests/PackageDSLKitTests/Extensions/Platform.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// Created by Leo Dion on 8/28/25.
66
//
77

8-
enum Platform {
9-
static let allowsProcess: Bool = {
8+
internal enum Platform {
9+
internal static let allowsProcess: Bool = {
1010
#if canImport(Foundation) && (os(macOS) || os(Linux))
1111
true
1212
#else

Tests/PackageDSLKitTests/Types/PackageDSLManagerBasicTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import Testing
44
@testable import PackageDSLKit
55

66
@Suite
7-
struct PackageDSLManagerBasicTests {
7+
internal struct PackageDSLManagerBasicTests {
88
@Test
9-
func generatePackageSwiftCreatesFiles() async throws {
9+
internal func generatePackageSwiftCreatesFiles() async throws {
1010
let tempDirectory = FileManager.default.temporaryDirectory
1111
.appendingPathComponent("PackageDSLManagerTests-\(UUID().uuidString)")
1212
let packageManager = await PackageDSLManager(
@@ -39,7 +39,7 @@ struct PackageDSLManagerBasicTests {
3939
}
4040

4141
@Test
42-
func hasDSLComponentsReturnsFalseWhenNoFiles() async {
42+
internal func hasDSLComponentsReturnsFalseWhenNoFiles() async {
4343
let tempDirectory = FileManager.default.temporaryDirectory
4444
.appendingPathComponent("PackageDSLManagerTests-\(UUID().uuidString)")
4545
let packageManager = await PackageDSLManager(
@@ -58,7 +58,7 @@ struct PackageDSLManagerBasicTests {
5858
}
5959

6060
@Test
61-
func hasTraditionalPackageSwiftDetectsFile() async throws {
61+
internal func hasTraditionalPackageSwiftDetectsFile() async throws {
6262
let tempDirectory = FileManager.default.temporaryDirectory
6363
.appendingPathComponent("PackageDSLManagerTests-\(UUID().uuidString)")
6464
let packageManager = await PackageDSLManager(

Tests/PackageDSLKitTests/Types/PackageDSLManagerComplexTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import Testing
44
@testable import PackageDSLKit
55

66
@Suite
7-
struct PackageDSLManagerComplexTests {
7+
internal struct PackageDSLManagerComplexTests {
88
@Test
9-
func generateAndValidateComplexPackage() async throws {
9+
internal func generateAndValidateComplexPackage() async throws {
1010
let tempDirectory = FileManager.default.temporaryDirectory
1111
.appendingPathComponent("PackageDSLManagerTests-ComplexPackage-\(UUID().uuidString)")
1212
let packageManager = await PackageDSLManager(

Tests/PackageDSLKitTests/Types/PackageDSLManagerSPMTests.swift

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Testing
55
@testable import SwiftPackageManagerKit
66

77
@Suite
8-
struct PackageDSLManagerSPMTests {
8+
internal struct PackageDSLManagerSPMTests {
99
@Test(
1010
.disabled(
1111
if: ProcessInfo.processInfo.shouldDisableSPMValidation(),
@@ -16,8 +16,9 @@ struct PackageDSLManagerSPMTests {
1616
"Unable to run SPM commands in non-macOS platforms"
1717
)
1818
)
19-
func validateGeneratedPackageWithSPMValidation() async throws {
20-
print("Is running Xcode Test in Github CI? \(ProcessInfo.processInfo.shouldDisableSPMValidation())")
19+
internal func validateGeneratedPackageWithSPMValidation() async throws {
20+
print(
21+
"Is running Xcode Test in Github CI? \(ProcessInfo.processInfo.shouldDisableSPMValidation())")
2122
print("Does allow Process API? \(Platform.allowsProcess)")
2223
#if canImport(Foundation) && (os(macOS) || os(Linux))
2324
let tempDirectory = FileManager.default.temporaryDirectory
@@ -95,47 +96,47 @@ struct PackageDSLManagerSPMTests {
9596
try packageSwiftContent.write(to: packageSwiftFile, atomically: true, encoding: .utf8)
9697
}
9798

98-
#if canImport(Foundation) && (os(macOS) || os(Linux))
99-
private func validateWithSPMCommands(_ tempDirectory: URL) async throws -> Executor {
100-
// Test SPM commands through our SPMExecutor
101-
let spmExecutor = try Executor(packageDirectory: tempDirectory, defaultTimeout: 60)
99+
#if canImport(Foundation) && (os(macOS) || os(Linux))
100+
private func validateWithSPMCommands(_ tempDirectory: URL) async throws -> Executor {
101+
// Test SPM commands through our SPMExecutor
102+
let spmExecutor = try Executor(packageDirectory: tempDirectory, defaultTimeout: 60)
102103

103-
// Test package dump-package
104-
let packageInfo = try await spmExecutor.dumpPackage()
105-
#expect(packageInfo.name == "SPMValidationTest")
106-
#expect(packageInfo.products.count == 1)
107-
#expect(packageInfo.products.first?.name == "SPMValidationTest")
108-
#expect(packageInfo.targets.count == 1)
109-
#expect(packageInfo.targets.first?.name == "SPMValidationTest")
104+
// Test package dump-package
105+
let packageInfo = try await spmExecutor.dumpPackage()
106+
#expect(packageInfo.name == "SPMValidationTest")
107+
#expect(packageInfo.products.count == 1)
108+
#expect(packageInfo.products.first?.name == "SPMValidationTest")
109+
#expect(packageInfo.targets.count == 1)
110+
#expect(packageInfo.targets.first?.name == "SPMValidationTest")
110111

111-
// Test package resolve (should be quick since no external dependencies)
112-
try await spmExecutor.resolvePackage()
112+
// Test package resolve (should be quick since no external dependencies)
113+
try await spmExecutor.resolvePackage()
113114

114-
// Test build (this ensures the package structure is correct)
115-
try await spmExecutor.buildPackage()
115+
// Test build (this ensures the package structure is correct)
116+
try await spmExecutor.buildPackage()
116117

117-
// Verify build artifacts were created
118-
let buildDirectory = tempDirectory.appendingPathComponent(".build")
119-
#expect(FileManager.default.fileExists(atPath: buildDirectory.path))
118+
// Verify build artifacts were created
119+
let buildDirectory = tempDirectory.appendingPathComponent(".build")
120+
#expect(FileManager.default.fileExists(atPath: buildDirectory.path))
120121

121-
return spmExecutor
122-
}
122+
return spmExecutor
123+
}
123124

124-
private func validateCoexistenceOfFormats(_ packageManager: PackageDSLManager) async {
125-
// Test that our PackageDSLManager can detect the traditional Package.swift
126-
#expect(await packageManager.hasTraditionalPackageSwift())
125+
private func validateCoexistenceOfFormats(_ packageManager: PackageDSLManager) async {
126+
// Test that our PackageDSLManager can detect the traditional Package.swift
127+
#expect(await packageManager.hasTraditionalPackageSwift())
127128

128-
// Generate DSL files alongside the Package.swift
129-
do {
130-
try await packageManager.generatePackageSwift()
131-
} catch {
132-
Issue.record("Failed to generate DSL files: \(error)")
133-
return
134-
}
129+
// Generate DSL files alongside the Package.swift
130+
do {
131+
try await packageManager.generatePackageSwift()
132+
} catch {
133+
Issue.record("Failed to generate DSL files: \(error)")
134+
return
135+
}
135136

136-
// Verify both formats coexist
137-
#expect(await packageManager.hasTraditionalPackageSwift())
138-
#expect(await packageManager.hasDSLComponents())
139-
}
137+
// Verify both formats coexist
138+
#expect(await packageManager.hasTraditionalPackageSwift())
139+
#expect(await packageManager.hasDSLComponents())
140+
}
140141
#endif
141142
}

0 commit comments

Comments
 (0)