diff --git a/package.json b/package.json index a994608..1236387 100644 --- a/package.json +++ b/package.json @@ -152,6 +152,12 @@ "description": "Path to the CodeQL CLI executable", "scope": "application" }, + "codeql-scanner.codeqlQueryPackPath": { + "type": "string", + "default": "", + "description": "Path to where the CodeQL query packs are stored", + "scope": "application" + }, "codeql-scanner.autoDetectGitHubExtension": { "type": "boolean", "default": true, @@ -284,4 +290,4 @@ "axios": "^1.3.4", "js-yaml": "^4.1.0" } -} +} \ No newline at end of file diff --git a/src/services/codeqlService.ts b/src/services/codeqlService.ts index f4a3a36..604d5d8 100644 --- a/src/services/codeqlService.ts +++ b/src/services/codeqlService.ts @@ -399,7 +399,7 @@ export class CodeQLService { addedLanguages.add(lang); continue; } - + //TODO: If language detected is typescript, map it to javascript // Check if it's an alias for a CodeQL language for (const [codeqlLang, aliases] of Object.entries(this.languages)) { if (aliases.includes(lang) && !addedLanguages.has(codeqlLang)) { @@ -469,9 +469,8 @@ export class CodeQLService { } progress.report({ - message: `Waiting for analysis (${ - recentAnalysis?.status || "pending" - })...`, + message: `Waiting for analysis (${recentAnalysis?.status || "pending" + })...`, }); } catch (error) { // Continue waiting even if there's an error @@ -958,8 +957,13 @@ export class CodeQLService { } private findQueryPack(language: string): string | undefined { + const config = vscode.workspace.getConfiguration("codeql-scanner") const codeqlDir = this.getCodeQLDirectory(); - const queryPackPath = path.join(codeqlDir, "packages"); + const queryPackPath = config.get( + "codeqlQueryPackPath", + path.join(codeqlDir, "packages") + ); + // const queryPackPath = path.join(codeqlDir, "packages"); // List all directories in the packages folder if (!fs.existsSync(queryPackPath)) { @@ -1096,7 +1100,7 @@ export class CodeQLService { else if (parseLevel >= 5.0) return "medium"; else if (parseLevel >= 3.0) return "low"; else return "info"; - } catch (error) {} + } catch (error) { } // Check if the level is a float switch (level?.toLowerCase()) {