Skip to content

Commit d4c26f3

Browse files
committed
Fix: warnings file path
1 parent 7eef071 commit d4c26f3

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

Sources/swift-doc-coverage/main.swift

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,11 @@ struct SwiftDocCoverage: ParsableCommand {
128128
let declarations = source.declarations(accessLevel: minimumAccessLevel.accessLevel)
129129
if declarations.count > 0 {
130130
index += 1
131-
let filePath = url.absoluteString
132131
if report == .coverage {
133-
Self.coverage(index: index, time: sourceTime, filePath: filePath, declarations: declarations, out: out)
132+
Self.coverage(index: index, time: sourceTime, path: url.path, declarations: declarations, out: out)
134133
}
135134
else if report == .warnings {
136-
Self.warnings(filePath: filePath, declarations: declarations, out: out)
135+
Self.warnings(path: url.path, declarations: declarations, out: out)
137136
}
138137
}
139138
}
@@ -243,7 +242,7 @@ struct SwiftDocCoverage: ParsableCommand {
243242
return time
244243
}
245244

246-
static func coverage(index: Int, time: Date, filePath: String, declarations: [SwiftDeclaration], out: Output?) {
245+
static func coverage(index: Int, time: Date, path: String, declarations: [SwiftDeclaration], out: Output?) {
247246
assert(declarations.count > 0)
248247

249248
let undocumented = declarations.filter { $0.hasDoc == false }
@@ -252,10 +251,10 @@ struct SwiftDocCoverage: ParsableCommand {
252251
let documentedCount = totalCount - undocumented.count
253252
let coverage = documentedCount * 100 / totalCount
254253

255-
out?.write("\(index)) \(filePath): \(coverage)% [\(documentedCount)/\(totalCount)] (\(string(from: -time.timeIntervalSinceNow)))")
254+
out?.write("\(index)) \(path): \(coverage)% [\(documentedCount)/\(totalCount)] (\(string(from: -time.timeIntervalSinceNow)))")
256255

257256
if undocumented.count > 0 {
258-
let fileName = NSString(string: filePath).lastPathComponent
257+
let fileName = NSString(string: path).lastPathComponent
259258

260259
out?.write("Undocumented:")
261260
undocumented.forEach {
@@ -265,13 +264,13 @@ struct SwiftDocCoverage: ParsableCommand {
265264
}
266265
}
267266

268-
static func warnings(filePath: String, declarations: [SwiftDeclaration], out: Output?) {
267+
static func warnings(path: String, declarations: [SwiftDeclaration], out: Output?) {
269268
assert(declarations.count > 0)
270269

271270
declarations
272271
.filter { $0.hasDoc == false }
273272
.forEach {
274-
out?.write("\(filePath):\($0.line):\($0.column): warning: No documentation for '\($0.name)'.")
273+
out?.write("\(path):\($0.line):\($0.column): warning: No documentation for '\($0.name)'.")
275274
}
276275
}
277276
}

0 commit comments

Comments
 (0)