|
Page 6 of 7
Organizing Your Analyses
SemmleCode allows you organize a collection of code queries into
a .QL Analysis, which can then be run on a set of projects. This
allows you to group project-specific code queries and specify the
projects to which they apply. This section shows you how to create, edit and run
a .QL analysis.
Creating a New Custom Analysis
- You can create your own custom analysis by right-clicking on
an element in the Package Explorer and selecting New >
Other... > Semmle .QL > .QL Analysis.

- After pressing next, you will be prompted to enter the
name for the analysis and optionally choose the location where the file
will be placed. Click OK once you have filled all the necessary
information.

- The New wizard should take display the newly created analysis
using the .QL Analysis Editor.
Editing an Analysis
The .QL Analysis Editor provides a rich editor to edit custom
analyses (which are stored in XML format). It contains three sections: General
Information, Scope and Queries.

Editing General Information
The General Information section allows you to edit the name and
description of the analysis. Just modify the contents of the name and
description textboxes to set the appropriate values.

Editing the Analysis' Scope
An analyis can be configured to run on a specific scope, which is useful if the
analysis contains project specific queries. To set the scope of an
analysis:
- To make the analysis on any scope, select Any in the
Scope section. When run, the analysis will run its queries on whatever
the active scope is at that time.

- To select a specific scope, select Custom in the Scope
section. This will enable the dropdown box which will allow you to
select from the existing scopes on your workspace. An analysis with a
custom scope will always be run on that scope, regardless of the active
scope at that time.

- Alternatively, you can click the Select/Edit button,
which brings up the scope
selection dialog. You can use this dialog to choose the scope for the
analysis, or create a new scope to use in the analysis.

Editing the Analysis' Queries
The Queries section of the Analysis Editor allows you to add and
remove queries to the analysis.
- To add a query, you can drag and drop an element from the
Package Explorer to the query section of the editor. This adds the
query to the analysis including the path structure of the element
relative to the workspace.

- Alternatively, you can add a query by right clicking on the
query section and selection Add Queries from the popup menu, or
by clicking the Add button.

This will bring up a query selection dialog which allows you to choose
from queries from the workspace, as well as from the queries that are
shipped with SemmleCode.

- To remove queries from the analysis, select them (or their
folders) from the queries section and select Delete from the
right-click menu or click the Remove button.

- You can double-click on a query or click the Edit button to
edit a selected query in the .QL
Query Editor.
Running the Analysis
You can run the analysis currently being edited by clicking the
Run button ( ) on the upper-right portion
of the .QL Analysis Editor.
The next section contains links to additional help resources
for SemmleCode Professional.
|