Skip to content

Commit ba1c50b

Browse files
authored
Merge pull request #4 from WritingPanda/package-path
Added support for specifying query pack location.
2 parents fa20c2d + 90fabdc commit ba1c50b

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
@@ -399,7 +399,7 @@ export class CodeQLService {
399399
addedLanguages.add(lang);
400400
continue;
401401
}
402-
402+
//TODO: If language detected is typescript, map it to javascript
403403
// Check if it's an alias for a CodeQL language
404404
for (const [codeqlLang, aliases] of Object.entries(this.languages)) {
405405
if (aliases.includes(lang) && !addedLanguages.has(codeqlLang)) {
@@ -469,9 +469,8 @@ export class CodeQLService {
469469
}
470470

471471
progress.report({
472-
message: `Waiting for analysis (${
473-
recentAnalysis?.status || "pending"
474-
})...`,
472+
message: `Waiting for analysis (${recentAnalysis?.status || "pending"
473+
})...`,
475474
});
476475
} catch (error) {
477476
// Continue waiting even if there's an error
@@ -958,8 +957,13 @@ export class CodeQLService {
958957
}
959958

960959
private findQueryPack(language: string): string | undefined {
960+
const config = vscode.workspace.getConfiguration("codeql-scanner")
961961
const codeqlDir = this.getCodeQLDirectory();
962-
const queryPackPath = path.join(codeqlDir, "packages");
962+
const queryPackPath = config.get<string>(
963+
"codeqlQueryPackPath",
964+
path.join(codeqlDir, "packages")
965+
);
966+
// const queryPackPath = path.join(codeqlDir, "packages");
963967

964968
// List all directories in the packages folder
965969
if (!fs.existsSync(queryPackPath)) {
@@ -1096,7 +1100,7 @@ export class CodeQLService {
10961100
else if (parseLevel >= 5.0) return "medium";
10971101
else if (parseLevel >= 3.0) return "low";
10981102
else return "info";
1099-
} catch (error) {}
1103+
} catch (error) { }
11001104

11011105
// Check if the level is a float
11021106
switch (level?.toLowerCase()) {

0 commit comments

Comments
 (0)