Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
TilakMaddy committed Feb 28, 2025
1 parent 059d318 commit 60782f0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
15 changes: 8 additions & 7 deletions src/panel-providers/diagnostics-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,14 @@ class AderynDiagnosticsProvider implements vscode.TreeDataProvider<DiagnosticIte
findProjectRoot(workspaceRoot),
);
logger.info(`[Sidebar]: Project root URI ${this.projectRootUri}`);
return await createAderynReportAndDeserialize(this.projectRootUri).catch(
(err) => {
logger.err(err);
vscode.window.showErrorMessage('Error fetching results from aderyn');
return null;
},
);
return await createAderynReportAndDeserialize(
logger,
this.projectRootUri,
).catch((err) => {
logger.err(err);
vscode.window.showErrorMessage('Error fetching results from aderyn');
return null;
});
}
return null;
}
Expand Down
7 changes: 6 additions & 1 deletion src/utils/install/aderyn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,15 @@ async function isAderynAvailableOnPath(logger: Logger): Promise<boolean> {
});
}

async function createAderynReportAndDeserialize(projectRootUri: string): Promise<Report> {
async function createAderynReportAndDeserialize(
logger: Logger,
projectRootUri: string,
): Promise<Report> {
const cmd = `aderyn ${projectRootUri} -o report.json --stdout --skip-cloc`;
logger.info(`Running ${cmd}`);
return executeCommand(cmd)
.then((text) => {
logger.info(`Got text - ${text}`);
const match = text.match(/STDOUT START([\s\S]*?)STDOUT END/);
if (!match) {
throw new Error('corrupted json');
Expand Down

0 comments on commit 60782f0

Please sign in to comment.