@@ -116,7 +116,7 @@ struct SwiftDocCoverage: ParsableCommand {
116116 }
117117
118118 let totalTime = Date ( )
119- var i = 0
119+ var index = 0
120120
121121 // Sources
122122 sources = try urls. map { url in
@@ -127,10 +127,10 @@ struct SwiftDocCoverage: ParsableCommand {
127127 if report != . json {
128128 let declarations = source. declarations ( level: minimumAccessLevel. accessLevel)
129129 if declarations. count > 0 {
130- i += 1
130+ index += 1
131131 let filePath = url. absoluteString
132132 if report == . coverage {
133- Self . coverage ( i : i , time: sourceTime, filePath: filePath, declarations: declarations, out: out)
133+ Self . coverage ( index : index , time: sourceTime, filePath: filePath, declarations: declarations, out: out)
134134 }
135135 else if report == . warnings {
136136 Self . warnings ( filePath: filePath, declarations: declarations, out: out)
@@ -156,14 +156,13 @@ struct SwiftDocCoverage: ParsableCommand {
156156 out? . write ( " \n Total: \( coverage) % [ \( documentedCount) / \( totalCount) ] ( \( Self . string ( from: - totalTime. timeIntervalSinceNow) ) ) " )
157157 }
158158 else if report == . json {
159- print ( sources)
160- // let encoder = JSONEncoder()
161- // encoder.outputFormatting = .prettyPrinted
162- //
163- // let data = try encoder.encode(sources)
164- // let json = String(data: data, encoding: .utf8)!
165- //
166- // output.write(json)
159+ let encoder = JSONEncoder ( )
160+ encoder. outputFormatting = . prettyPrinted
161+
162+ let data = try encoder. encode ( sources)
163+ let json = String ( data: data, encoding: . utf8) !
164+
165+ out? . write ( json)
167166 }
168167 }
169168
@@ -247,7 +246,7 @@ struct SwiftDocCoverage: ParsableCommand {
247246 return time
248247 }
249248
250- static func coverage( i : Int , time: Date , filePath: String , declarations: [ SwiftDeclaration ] , out: Output ? ) {
249+ static func coverage( index : Int , time: Date , filePath: String , declarations: [ SwiftDeclaration ] , out: Output ? ) {
251250 assert ( declarations. count > 0 )
252251
253252 let undocumented = declarations. filter { $0. isDocumented == false }
@@ -256,7 +255,7 @@ struct SwiftDocCoverage: ParsableCommand {
256255 let documentedCount = totalCount - undocumented. count
257256 let coverage = documentedCount * 100 / totalCount
258257
259- out? . write ( " \( i ) ) \( filePath) : \( coverage) % [ \( documentedCount) / \( totalCount) ] ( \( string ( from: - time. timeIntervalSinceNow) ) ) " )
258+ out? . write ( " \( index ) ) \( filePath) : \( coverage) % [ \( documentedCount) / \( totalCount) ] ( \( string ( from: - time. timeIntervalSinceNow) ) ) " )
260259
261260 if undocumented. count > 0 {
262261 let fileName = NSString ( string: filePath) . lastPathComponent
0 commit comments