Skip to content

Commit f376da8

Browse files
committed
Lint
1 parent 080e170 commit f376da8

5 files changed

Lines changed: 10 additions & 9 deletions

File tree

Sources/PackLib/Planner.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public struct Planner: Sendable {
119119
return Plan(app: app, extensions: extensionProducts)
120120
}
121121

122-
// swiftlint:disable cyclomatic_complexity function_parameter_count
122+
// swiftlint:disable cyclomatic_complexity function_parameter_count function_body_length
123123
private func product(
124124
from graph: PackageGraph,
125125
matching name: String?,

Sources/XCAssetCompiler/CAR/CSIWriter.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ enum CSIWriter {
7373
return w.data
7474
}
7575

76+
// swiftlint:disable:next function_parameter_count
7677
private static func writeHeader(
7778
into w: inout ByteWriter,
7879
renditionFlags: UInt32,
@@ -163,7 +164,7 @@ enum CSIWriter {
163164
w.writeLE(UInt32(1004))
164165
w.writeLE(UInt32(8))
165166
w.writeLE(UInt32(0))
166-
w.writeLE(UInt32(Float(1.0).bitPattern))
167+
w.writeLE(UInt32(Float(1).bitPattern))
167168

168169
// Type 1006 (4-byte value): always 1 in the reference. Likely a
169170
// bitmap-count/has-mipmap-stages flag.

Sources/XCAssetCompiler/Schema/Contents.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,12 @@ struct ColorSetContents: Codable, Sendable {
158158
guard let n = UInt8(hex, radix: 16) else {
159159
throw XCAssetCompilerError.invalidColorComponent(s)
160160
}
161-
return Double(n) / 255.0
161+
return Double(n) / 255
162162
}
163163
guard let n = Double(s) else {
164164
throw XCAssetCompilerError.invalidColorComponent(s)
165165
}
166-
return n > 1 ? n / 255.0 : n
166+
return n > 1 ? n / 255 : n
167167
}
168168
return (try parse(red), try parse(green), try parse(blue), try parse(alpha))
169169
}

Tests/XCAssetCompilerTests/CSIWriterTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ struct CSIWriterTests {
5252

5353
@Test("Color CSI body starts with COLR magic and four IEEE-754 doubles")
5454
func colorBody() {
55-
let body = ColorBody(red: 1.0, green: 0.0, blue: 0.5, alpha: 1.0, colorSpaceID: 0)
55+
let body = ColorBody(red: 1, green: 0, blue: 0.5, alpha: 1, colorSpaceID: 0)
5656
let data = CSIWriter.color(name: "Accent", body: body)
5757
// CSI header is 184 bytes; body starts at offset 184
5858
#expect(data.count >= 184 + 4 + 4 + 4 + 4 + 8 * 4)

Tests/XCAssetCompilerTests/ColorRendererTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct ColorRendererTests {
3737
#expect(abs(body.red - 0.5) < 1e-9)
3838
#expect(abs(body.green - 0.25) < 1e-9)
3939
#expect(abs(body.blue - 0.75) < 1e-9)
40-
#expect(abs(body.alpha - 1.0) < 1e-9)
40+
#expect(abs(body.alpha - 1) < 1e-9)
4141
#expect(body.colorSpaceID == 1)
4242
}
4343

@@ -97,8 +97,8 @@ struct ColorRendererTests {
9797
Issue.record("expected color body")
9898
return
9999
}
100-
#expect(abs(body.red - 1.0) < 1e-9)
101-
#expect(abs(body.green - 0.0) < 1e-9)
102-
#expect(abs(body.blue - 128.0 / 255.0) < 1e-9)
100+
#expect(abs(body.red - 1) < 1e-9)
101+
#expect(abs(body.green - 0) < 1e-9)
102+
#expect(abs(body.blue - 128 / 255) < 1e-9)
103103
}
104104
}

0 commit comments

Comments
 (0)