JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.

If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.

If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.

CodeSonar® 9.2p0 CONFIDENTIAL CodeSecure Inc

Task: Find Warnings That Match Specific Criteria

At any given time, you will probably be interested in only a subset of the warnings issued by CodeSonar and stored on the hub. For example, you may want to see only warnings belonging to a specific user, or only warnings in one particular file. The search facilities in CodeSonar allow you to find the warnings you are interested in.

Search functionality can always be accessed through the search widget that appears on every page in the CodeSonar GUI. The following annotated screenshot fragment shows the different parts of the search widget.

annotated screenshot fragment: search widget

What do you want to do?

full-text search Find warnings whose reports contain one or more specific strings (in any field).
advanced search Find warnings by specifying the desired contents for one or more report fields.
search language search Find warnings by using the search language to precisely specify a search.

All of these methods will list the matching warnings on a Warning Search Result Page.

Full-Text Search

This is the simplest way to search for warnings. Given one or more strings, the CodeSonar full-text search will list all warnings whose reports contain the string or strings, regardless of where in the report they occur.

General Method

  1. Make sure the domain/scope menu selection specifies that you are searching for warnings. If not, make a new selection.
  2. Type your search term(s) into the search field.
  3. Click Search.
  4. Choose a Visible Warnings setting to apply to the search results, if appropriate.

Full-Text Search Example 1: Find Warning With Instance ID 365

So long as there is a warning with Instance ID 365, this is the most straightforward method for finding it.

  1. Select warnings in all projects from the domain/scope menu.
  2. Type 365 into the search field.
  3. Click Search.
  4. Select all from the Visible Warnings selector to see all instances.

Note that this search will also find any other warnings that contain the string "365", such as

Full-Text Search Example 2: Find Null Pointer Dereference Warnings in the Most Recent Analyses of All Projects

  1. Select warnings in last analyses from the domain/scope menu.
  2. Type Null Pointer Dereference into the search field.
  3. Click Search.
  4. Select all from the Visible Warnings selector to see all instances.

Note that this search will also find any other warnings that contain all of the strings "Null", "Pointer" and "Dereference" together or separately but are not themselves Null Pointer Dereference warnings. For example, if a user had added the comment "Fix null pointer dereferences before fixing this" to the report for a Unused Code warning, that warning will be found. There are two ways to address this.

Advanced Search for Warnings

The CodeSonar advanced search allows you to specify searches more precisely than full-text search. It is useful when the search criteria are complex and when full-text search would match a broader set of warnings than is actually desired.

General Method

  1. Click the Advanced Search link in the search widget.
  2. Make sure the Warnings tab is selected.
  3. Enter your desired search criteria into the relevant field or fields on the Advanced Search page.
  4. Click Search Warnings.

Advanced Search Example 1: Find Warning With Instance ID 365

This process is slightly more involved than that for finding warning 365 with full-text search, but has the advantage of only finding warnings whose Instance ID is "365", and not ones where "365" occurs only in some other field.

  1. Go to the Advanced Search page.
  2. Make sure the Warnings tab is selected.
  3. Type .365 into the ID field (in the Details section). The dot at the beginning indicates that you want to match Instance IDs only - not Group IDs.
  4. Click Search Warnings.

This search will find the warning with Instance ID 365 (if any).

Advanced Search Example 2: Find Null Pointer Dereference Warnings in the Most Recent Analyses of All Projects

This search will find only Null Pointer Dereference warnings.

  1. Go to the Advanced Search page.
  2. Enter Null Pointer Dereference in the Class field (in the Details section).
  3. Select all projects, most recent analyses from the scope menu at the top of the Warnings tab.
  4. Click Search Warnings.

Search Language Search

The search language search combines the precision of the advanced search with the simple interface of the full-text search.

General Method

  1. Choose an appropriate setting in the domain/scope menu (the scope should be warnings).
  2. Choose a Visible Warnings filter to apply to the results of your search, if desired.
  3. Determine a suitable warning search language expression for your search.
  4. Type your search language expression into the search field that is present at the top of every CodeSonar GUI page.
  5. Click Search.

Search Language Example 1: Find Warning with Instance ID 365

This search will find the warning with Instance ID 365 (provided it exists), and only that warning.

  1. Select warnings in all projects from the domain/scope menu.
  2. Type iid:365 into the search field.
  3. Click Search.
  4. Select all from the Visible Warnings selector to see all instances.

Search Language Example 2: Find Null Pointer Dereference Warnings in the Most Recent Analyses of All Projects

This search has exactly the same results as the advanced search version but has the advantage that it can be executed from any screen in the CodeSonar GUI.

  1. Select warnings in last analyses from the domain/scope menu.
  2. Type class:"null pointer dereference" into the search field.
  3. Click Search.
  4. Select all from the Visible Warnings selector to see all instances.

Links

Related tasks

Using CodeSonar

 

To report problems with this documentation, please visit https://support.codesecure.com/.