Skip to content

Commit e52d884

Browse files
Add intructions for query running
1 parent 7a98111 commit e52d884

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

CodeQL_Queries/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
To run the queries in this repository:
2+
1. Click the green "Code" button > Codespaces > Create a codespace on main. A new codespace will be created for you with VS Code CodeQL extension preinstalled.
3+
2. When the codespace finishes setting up, open the terminal, and find the path to the codeql binary (which comes preinstalled with the VS Code CodeQL extension) with the command:
4+
```bash
5+
find ~ -type f -name codeql -executable 2>/dev/null
6+
```
7+
It will most likely look similar to this:
8+
```
9+
/home/codespace/.vscode-remote/data/User/globalStorage/github.vscode-codeql/distribution1/codeql/codeql
10+
```
11+
3. Using the CodeQL binary, go to the language folder with the query you want to run `codeql pack install, for example:
12+
```bash
13+
cd cpp
14+
/home/codespace/.vscode-remote/data/User/globalStorage/github.vscode-codeql/distribution1/codeql/codeql pack install
15+
```
16+
This will install the CodeQL library files required to run the CodeQL queries.
17+
4. Press `Ctrl/Cmd + Shift + R` to reload the window to see syntax highlighting etc.
18+
5. Check the README in the folder with the query you are interested in, and add the database listed in the README to your VS Code CodeQL extension.
19+
6. Open the query file you are interested in, right-click and choose `CodeQL: Run Query on selected database` from the dropdowns.

0 commit comments

Comments
 (0)