@@ -5,7 +5,6 @@ import * as path from 'path';
55
66import * as vscode from 'vscode' ;
77
8- // eslint-disable-next-line import/order
98import Config from './config' ;
109import GlobalConfig from '../../globalConfig' ;
1110import { fullToRelativePath , getRootDir } from '../../utils' ;
@@ -41,9 +40,6 @@ export async function runCodeCoverageAction(renderer: CoverageRenderer, function
4140
4241 vscode . window . showWarningMessage ( warningMessage ) ;
4342
44- const activeEditor = vscode . window . activeTextEditor ;
45- const currentFileUri = activeEditor ?. document . uri . fsPath ;
46-
4743 // Run this command: cargo kani --coverage -Z source-coverage --harness verify_success
4844 // to generate the source coverage output
4945 const playbackCommand : string = `${ kaniBinaryPath } --coverage -Z source-coverage --harness ${ functionName } ` ;
@@ -54,7 +50,6 @@ export async function runCodeCoverageAction(renderer: CoverageRenderer, function
5450
5551 // Convert the array of (file, line, status) objects into Map<file <line, status>>
5652 // since we need to cache this globally
57- // const coverageGlobalMap = parseCoverageFormatted(coverageOutputArray);
5853 globalConfig . setCoverage ( coverageGlobalMap ) ;
5954 renderer . renderInterface ( vscode . window . visibleTextEditors , coverageGlobalMap ) ;
6055 }
@@ -125,7 +120,6 @@ function readJsonFromPath(filePath: string): any {
125120 */
126121async function parseKaniCoverageOutput ( stdout : string ) : Promise < any | undefined > {
127122 const kaniOutput : string = stdout ;
128- const kaniOutputArray : string [ ] = kaniOutput . split ( 'Source-based code coverage results:\n' ) ;
129123
130124 const jsonFilePath = getCoverageJsonPath ( kaniOutput ) ;
131125 const coverageMap : Map < string , Map < any , string > > = new Map ( ) ;
@@ -186,60 +180,10 @@ async function parseKaniCoverageOutput(stdout: string): Promise<any | undefined>
186180 terminal . show ( ) ;
187181 }
188182
189- // const coverage = parseCoverageData(coverageResultsArray);
190183 // No command found from Kani
191184 return coverageMap ;
192185}
193186
194- // Parse `CoverageEntry` objects and convert it into CoverageMap or a map<file_path, map<line_number, status>>.
195- // We store this map as the global cache since it allows easy sorting and retrieval by file name, needed by VS Code.
196- function parseCoverageFormatted ( entries : CoverageEntry [ ] ) : Map < string , Map < number , string > > {
197- const nestedMap : Map < string , Map < number , string > > = new Map ( ) ;
198-
199- for ( const entry of entries ) {
200- const { filePath, lineNumber, coverageStatus } = entry ;
201-
202- // Check if the outer map already has an entry for the filePath
203- let innerMap = nestedMap . get ( filePath ) ;
204-
205- // If not, create a new inner map and set it in the outer map
206- if ( ! innerMap ) {
207- innerMap = new Map < number , CoverageStatus > ( ) ;
208- nestedMap . set ( filePath , innerMap ) ;
209- }
210-
211- // Set the coverageStatus in the inner map for the lineNumber
212- innerMap . set ( lineNumber , coverageStatus ) ;
213- }
214-
215- return nestedMap ;
216- }
217-
218- // Convert coverage Kani's output into CoverageEntry objects
219- function parseCoverageData ( data : string [ ] ) : CoverageEntry [ ] {
220- const coverageEntries : CoverageEntry [ ] = [ ] ;
221-
222- for ( const entry of data ) {
223- const parts = entry . split ( ', ' ) ;
224-
225- if ( parts . length === 3 ) {
226- const [ filePath , lineNumberStr , coverageStatus ] = parts ;
227- if ( filePath . includes ( 'Complete - ' ) ) {
228- return coverageEntries ;
229- }
230- const lineNumber = parseInt ( lineNumberStr . trim ( ) , 10 ) ;
231-
232- coverageEntries . push ( {
233- filePath,
234- lineNumber,
235- coverageStatus,
236- } ) ;
237- }
238- }
239-
240- return coverageEntries ;
241- }
242-
243187// Class representing the Renderer that handles rendering coverage highlights in the editor.
244188export class CoverageRenderer {
245189 private configStore : Config ;
@@ -249,7 +193,7 @@ export class CoverageRenderer {
249193 this . configStore = configStore ;
250194 }
251195
252- /**
196+ /**
253197 * Renders coverage highlights for multiple files.
254198 * @param editors - An array of text editor files to render coverage highlights for.
255199 * @param coverageMap - A map containing coverage data for each file.
@@ -271,7 +215,6 @@ export class CoverageRenderer {
271215 // Fetch the coverage data for a file from the coverageMap.
272216 const relativePath = fullToRelativePath ( editor . document . fileName ) ;
273217 const fileMap = coverageMap . get ( relativePath ) ! ;
274- // const coverageLines = this.createCoverage(editor.document, fileMap);
275218
276219 const coverageLines = this . convertMapToLines ( fileMap ) ;
277220 this . renderHighlight ( editor , coverageLines ) ;
0 commit comments