Skip to content

Commit f7a3ac1

Browse files
committed
Added support for specifying query pack location.
1 parent 5b294e0 commit f7a3ac1

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@
152152
"description": "Path to the CodeQL CLI executable",
153153
"scope": "application"
154154
},
155+
"codeql-scanner.codeqlQueryPackPath": {
156+
"type": "string",
157+
"default": "",
158+
"description": "Path to where the CodeQL query packs are stored",
159+
"scope": "application"
160+
},
155161
"codeql-scanner.autoDetectGitHubExtension": {
156162
"type": "boolean",
157163
"default": true,
@@ -284,4 +290,4 @@
284290
"axios": "^1.3.4",
285291
"js-yaml": "^4.1.0"
286292
}
287-
}
293+
}

src/services/codeqlService.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ export class CodeQLService {
395395
addedLanguages.add(lang);
396396
continue;
397397
}
398-
398+
//TODO: If language detected is typescript, map it to javascript
399399
// Check if it's an alias for a CodeQL language
400400
for (const [codeqlLang, aliases] of Object.entries(this.languages)) {
401401
if (aliases.includes(lang) && !addedLanguages.has(codeqlLang)) {
@@ -465,9 +465,8 @@ export class CodeQLService {
465465
}
466466

467467
progress.report({
468-
message: `Waiting for analysis (${
469-
recentAnalysis?.status || "pending"
470-
})...`,
468+
message: `Waiting for analysis (${recentAnalysis?.status || "pending"
469+
})...`,
471470
});
472471
} catch (error) {
473472
// Continue waiting even if there's an error
@@ -954,8 +953,13 @@ export class CodeQLService {
954953
}
955954

956955
private findQueryPack(language: string): string | undefined {
956+
const config = vscode.workspace.getConfiguration("codeql-scanner")
957957
const codeqlDir = this.getCodeQLDirectory();
958-
const queryPackPath = path.join(codeqlDir, "packages");
958+
const queryPackPath = config.get<string>(
959+
"codeqlQueryPackPath",
960+
path.join(codeqlDir, "packages")
961+
);
962+
// const queryPackPath = path.join(codeqlDir, "packages");
959963

960964
// List all directories in the packages folder
961965
if (!fs.existsSync(queryPackPath)) {
@@ -1092,7 +1096,7 @@ export class CodeQLService {
10921096
else if (parseLevel >= 5.0) return "medium";
10931097
else if (parseLevel >= 3.0) return "low";
10941098
else return "info";
1095-
} catch (error) {}
1099+
} catch (error) { }
10961100

10971101
// Check if the level is a float
10981102
switch (level?.toLowerCase()) {

0 commit comments

Comments
 (0)