Skip to content

Commit

Permalink
fix(patch): Fix init output to be more descriptive of actions taken (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
hassila authored Mar 29, 2023
1 parent ba5213d commit 1011cb4
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 4 deletions.
6 changes: 4 additions & 2 deletions Plugins/BenchmarkTool/BenchmarkTool+CreateBenchmark.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ extension BenchmarkTool {
subPath.append("Package.swift") // package/Benchmarks/targetName
outputPath.append(subPath.components)

print("Adding new executable target \(targetName) to \(outputPath.description)")

// Write out benchmark boilerplate
do {
let fd = try FileDescriptor.open(
Expand Down Expand Up @@ -86,8 +88,6 @@ extension BenchmarkTool {
return
}

print("Creating benchmark \(targetName) in \(self.baselineStoragePath)")

var boilerplate = """
// Benchmark boilerplate generated by Benchmark
Expand Down Expand Up @@ -115,6 +115,8 @@ extension BenchmarkTool {
outputPath.append(subPath.components)
outputPath.append("\(targetName).swift")

print("Creating benchmark in \(outputPath.description)")

// Write out benchmark boilerplate, open with .exclusiveCreate to abort if file exists
do {
let fd = try FileDescriptor.open(
Expand Down
3 changes: 3 additions & 0 deletions Sources/Benchmark/ARCStats/ARCStatsProducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Atomics
import SwiftRuntimeHooks

// swiftlint:disable prefer_self_in_static_references

final class ARCStatsProducer {
typealias SwiftRuntimeHook = @convention(c) (UnsafeRawPointer?, UnsafeMutableRawPointer?) -> Void

Expand Down Expand Up @@ -46,3 +47,5 @@ final class ARCStatsProducer {
releaseCount: ARCStatsProducer.releaseCount.load(ordering: .relaxed))
}
}

// swiftlint:enable prefer_self_in_static_references
1 change: 1 addition & 0 deletions Sources/Benchmark/Benchmark.swift
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ public extension Benchmark {
case maxIterations
case thresholds
}
// swiftlint:enable nesting
}
}

Expand Down
1 change: 1 addition & 0 deletions Sources/Benchmark/BenchmarkExecutor+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,4 @@ extension BenchmarkExecutor {
}
}
}
// swiftlint:enable cyclomatic_complexity
2 changes: 2 additions & 0 deletions Sources/Benchmark/BenchmarkExecutor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -320,3 +320,5 @@ internal final class BenchmarkExecutor {
return results
}
}

// swiftlint:enable cyclomatic_complexity function_body_length
1 change: 1 addition & 0 deletions Sources/Benchmark/BenchmarkInternals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ public enum BenchmarkCommandReply: Codable {
case end // end of query for list/result
case error(_ description: String) // error while performing operation (e.g. 'run')
}
// swiftlint:enable all
2 changes: 2 additions & 0 deletions Sources/Benchmark/BenchmarkMetric.swift
Original file line number Diff line number Diff line change
Expand Up @@ -338,3 +338,5 @@ public extension BenchmarkMetric {
}
}
}

// swiftlint:enable cyclomatic_complexity function_body_length
2 changes: 1 addition & 1 deletion Sources/Benchmark/BenchmarkResult.swift
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ public struct BenchmarkResult: Codable, Comparable, Equatable {
return BenchmarkScalingFactor(rawValue: newScale)!
}

// swiftlint:disable identifier_name
// from SO to avoid Foundation/Numerics
internal func pow<T: BinaryInteger>(_ base: T, _ power: T) -> T {
func expBySq(_ y: T, _ x: T, _ n: T) -> T {
Expand Down Expand Up @@ -532,3 +531,4 @@ public extension BenchmarkTimeUnits {
}
}
}
// swiftlint:enable file_length identifier_name function_parameter_count function_body_length type_body_length
2 changes: 2 additions & 0 deletions Sources/Benchmark/BenchmarkRunner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,5 @@ public struct BenchmarkRunner: AsyncParsableCommand, BenchmarkRunnerReadWrite {
}
}
}

// swiftlint:enable cyclomatic_complexity function_body_length
1 change: 1 addition & 0 deletions Sources/Benchmark/BenchmarkThresholds+Defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,4 @@ public extension BenchmarkThresholds {
BenchmarkThresholds()
}
}
// swiftlint:enable discouraged_none_name
Original file line number Diff line number Diff line change
Expand Up @@ -359,3 +359,5 @@ struct Large: Codable {
struct MergedLextent: Codable {
let curlextents: Int
}

// swiftlint:enable all
1 change: 1 addition & 0 deletions Sources/Benchmark/NIOLock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,4 @@ extension NIOLock {

extension NIOLock: Sendable {}
extension NIOLock._Storage: Sendable {}
// swiftlint:disable all
2 changes: 2 additions & 0 deletions Sources/Benchmark/Statistics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,5 @@ public final class Statistics: Codable {
return original / factor
}
}

// swiftlint:enable all
4 changes: 3 additions & 1 deletion Tests/BenchmarkTests/BenchmarkResultTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@testable import Benchmark
import XCTest

// swiftlint:disable function_body_length type_body_length
// swiftlint:disable function_body_length type_body_length file_length
final class BenchmarkResultTests: XCTestCase {
func testBenchmarkResultEqual() throws {
let firstStatistics = Statistics()
Expand Down Expand Up @@ -398,3 +398,5 @@ final class BenchmarkResultTests: XCTestCase {
XCTAssert(description.count > 4)
}
}

// swiftlint:enable function_body_length type_body_length
2 changes: 2 additions & 0 deletions Tests/BenchmarkTests/BenchmarkRunnerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,5 @@ final class BenchmarkRunnerTests: XCTestCase, BenchmarkRunnerReadWrite {
XCTAssertEqual(writeCount, 6) // 3 tests results + 3 end markers
}
}

// swiftlint:enable test_case_accessibility

0 comments on commit 1011cb4

Please sign in to comment.