Skip to content

Instantly share code, notes, and snippets.

@v-p-b
Last active July 25, 2020 20:26
Show Gist options
  • Save v-p-b/5f95f144341dcdb0f717c22064428020 to your computer and use it in GitHub Desktop.
Save v-p-b/5f95f144341dcdb0f717c22064428020 to your computer and use it in GitHub Desktop.
Setting up a CodeQL workspace without the starter repository

Setting up a CodeQL workspace without the starter repository in VS Code

Install the CodeQL extension and configure the CLI!

Directory structure

This is not strictly mandatory, but you probably want something like this:

my_workspace/
  .vscode/
    settings.json
  codeql/
  my_company/
    my_project/
      my_query1.ql
      my_query2.ql
      ...
      qlpack.yml
      queries.xml

Where codeql/ is a clone of this repository: https://github.com/github/codeql . Symlinking didn't work for me.

Metadata

settings.json

Excluding CodeQL libraries from VS Code's file system watcher (there are too many files in there):

{
    "files.watcherExclude": {
        "**/codeql/**": true
    }
}

qlpack.yml

Metadata for your queries. The libraryPathDependencies attribute helps the extension to find the language specific libraries and configure IntelliSense.

name: codeql-my-queries-foo
version: 0.0.0
libraryPathDependencies: codeql-MYLANGUAGE

More info.

queries.xml

Without this file queries won't execute.

<queries language="MYLANGUAGE"/>

More info.

IntelliSense

If IntelliSense doesn't work despite following the above configuration, try 1) saving the workspace 2) and restart VSCode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment