Skip to content

Commit 02aa19a

Browse files
authored
Merge branch 'main' into copilot/fix-2
2 parents 0b9a3f0 + ba1c50b commit 02aa19a

File tree

5 files changed

+28
-7
lines changed

5 files changed

+28
-7
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @GeekMasher

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ node_modules
33
.vscode-test
44
*.vsix
55
.DS_Store
6+
7+
# Temporary test files
8+
test_*.js

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717

1818
Seamlessly integrate GitHub's powerful CodeQL scanning engine directly into your VS Code workflow. Detect vulnerabilities, find security flaws, and improve code quality without leaving your editor.
1919

20+
> [!NOTE]
21+
> This is **not** an offical GitHub project
22+
2023
## ✨ Key Features
2124

2225
- **🛡️ Instant Security Analysis**: Scan your code for vulnerabilities directly from VSCode

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,12 @@
157157
"description": "Path to the CodeQL CLI executable",
158158
"scope": "application"
159159
},
160+
"codeql-scanner.codeqlQueryPackPath": {
161+
"type": "string",
162+
"default": "",
163+
"description": "Path to where the CodeQL query packs are stored",
164+
"scope": "application"
165+
},
160166
"codeql-scanner.autoDetectGitHubExtension": {
161167
"type": "boolean",
162168
"default": true,
@@ -295,4 +301,4 @@
295301
"axios": "^1.3.4",
296302
"js-yaml": "^4.1.0"
297303
}
298-
}
304+
}

src/services/codeqlService.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ export class CodeQLService {
137137
);
138138
}
139139

140+
// Ensure languages are always mapped to CodeQL languages, even if manually configured
141+
// This prevents issues where users might manually configure "typescript" instead of "javascript"
142+
languages = this.mapLanguagesToCodeQL(languages);
143+
140144
this.logger.info(
141145
"CodeQLService",
142146
`Detected languages: [${languages.join(", ")}]`
@@ -736,7 +740,7 @@ export class CodeQLService {
736740
addedLanguages.add(lang);
737741
continue;
738742
}
739-
743+
//TODO: If language detected is typescript, map it to javascript
740744
// Check if it's an alias for a CodeQL language
741745
for (const [codeqlLang, aliases] of Object.entries(this.languages)) {
742746
if (aliases.includes(lang) && !addedLanguages.has(codeqlLang)) {
@@ -806,9 +810,8 @@ export class CodeQLService {
806810
}
807811

808812
progress.report({
809-
message: `Waiting for analysis (${
810-
recentAnalysis?.status || "pending"
811-
})...`,
813+
message: `Waiting for analysis (${recentAnalysis?.status || "pending"
814+
})...`,
812815
});
813816
} catch (error) {
814817
// Continue waiting even if there's an error
@@ -1331,8 +1334,13 @@ export class CodeQLService {
13311334
}
13321335

13331336
private findQueryPack(language: string): string | undefined {
1337+
const config = vscode.workspace.getConfiguration("codeql-scanner")
13341338
const codeqlDir = this.getCodeQLDirectory();
1335-
const queryPackPath = path.join(codeqlDir, "packages");
1339+
const queryPackPath = config.get<string>(
1340+
"codeqlQueryPackPath",
1341+
path.join(codeqlDir, "packages")
1342+
);
1343+
// const queryPackPath = path.join(codeqlDir, "packages");
13361344

13371345
// List all directories in the packages folder
13381346
if (!fs.existsSync(queryPackPath)) {
@@ -1469,7 +1477,7 @@ export class CodeQLService {
14691477
else if (parseLevel >= 5.0) return "medium";
14701478
else if (parseLevel >= 3.0) return "low";
14711479
else return "info";
1472-
} catch (error) {}
1480+
} catch (error) { }
14731481

14741482
// Check if the level is a float
14751483
switch (level?.toLowerCase()) {

0 commit comments

Comments
 (0)