Semmle 1.22
Skip to end of metadata
Go to start of metadata

This topic describes how to export a snapshot for use with the QL plugins and extensions, or to upload to LGTM using the LGTM API.

Overview

The QL plugins and extensions allow you to write and run queries on project snapshots locally in your IDE. If you want to create and test queries in your IDE , then you need to have:

  • One or more Semmle snapshots to run queries against.
  • A copy of the license file (stored in a license directory—either a sub-directory of the odasa directory or the SEMMLE_HOME directory, or in the location explicitly defined by SEMMLE_LICENSE_DIR).

The best way to create a database to use in a QL plugin or extension is to export a recent snapshot using the export command.

If you have built your snapshot using the QL command-line tools, you can also carry out continuous security analysis by uploading it to LGTM using the LGTM API. For more information, see About LGTM.

Exporting a snapshot

The export command has been designed to enable you to export a snapshot directory in the format required by QL for Eclipse.

To export the most recent snapshot

The export command is commonly run from the odasa directory (although it can equally be run from the project directory, which removes the need to specify the project explicitly). At the command prompt, enter:

odasa export --project <project-config-dir> --latest

where <project-config-dir> is the path to the directory where the project configuration file is stored. This must be specified either as an absolute path, or as a path relative to the current working directory. The most recent snapshot built for that project is exported into a zip archive in the current working directory with the name <project-name>-<revision>.zip. You can override this default location using the --output flag.

If you want to export a snapshot other than the most recent one, you can omit the --latest flag and specify a particular snapshot directory to export instead.

Example

If you exported the latest snapshot for the Hadoop project by running: odasa export --project projects/Hadoop --latest from the odasa directory, then the snapshot might be exported as odasa/Hadoop-revision-2017-December-23--12-15-31.zip.