Searching in Klocwork Static Code Analysis
|In this topic:|
Searching in Klocwork Static Code Analysis
This article explains how to search for detected issues in Klocwork Static Code Analysis. It also provides a list of supported search keywords.
First, you need to access the issue list:
- Log into Static Code Analysis, if you haven't already done so.
You see a list of projects for which you have permissions on the current Klocwork Server host and port.
- For any project in the list, click the New or Open issues link.
The issue list appears, showing the current search query:
Your view affects your search results
The current view affects search results. Use the *default* view to include issues of all severities, categories and modules.
The Searches list
The Searches list is pre-populated with useful searches. Klocwork Static Code Analysis keeps a history of your text-search activity, so you can save your complex search queries. Any text you type in the text field is saved in the search history, but the name is grayed out in the list until you save it permanently. Unsuccessful queries and queries longer than 255 symbols are not saved.
You can click the icon to the left to instantly generate a report based on your search.
Use keywords or full-text searches
Use keywords, full-text search, or a combination. Full-text searches are applied to entity names, file paths, issue comments, issue codes, issue messages, owner names and bug IDs from a bug tracking system integrated with Klocwork Static Code Analysis. Searching, whether by keyword or full text, is not case sensitive.
- Do not insert a space after the colon that follows the keyword.
- Multiple values for a keyword should be separated by commas, whereas multiple keywords should be separated by spaces. For example: code:cmp.obj,cmp.str file:cruise,outsinks owner:jlee
If you type: file:foo.c moo.c noo.c the search engine will look for files that match "foo.c" and then do a full-text search for "moo.c" and "noo.c" in entity names, file paths, issue comments, issue codes and owner names.
Here's a list of the keywords you can use for:
- searching issues
- creating or updating views
- the 'query' parameter for the search, create_view and update_view actions of the Klocwork Web API
If you enter an unrecognized keyword when searching for issues or creating a view, you'll see a warning.
|build (not supported for views)||build:<build_name or build_number>
Note: You can only search by one build at a time. Other acceptable syntax:
Tip: You can use the build:any keyword, along with specifying state:Fixed to find issues fixed in a previous build. For example, to find a 'FNH.MUST' issue fixed in a previous build, search for build:any state:Fixed FNH.MUST.
|build:build_2 or build:beta|
Note: To use this keyword, you must integrate Static Code Analysis with your bug tracker. For more information, see Integrating bug tracking with Static Code Analysis.
Note: Acceptable time formats are 'yyyy-mm-dd hh:mm:ss' or 'yyyy-mm-dd'. Other acceptable syntax:
|cited:'2011-10-24 07:45:30'-'2011-11-24 21:30:00' cited:2011-11-24 cited:'2011-11-24'-'now' cited:today cited:week|
Note: Use quotes for expressions that contain spaces or punctuation.
|comment:"check with bob on this issue"|
|diff (not supported for views)||
|grouping (not supported for views)||grouping:<'on' or 'off'>||grouping:off|
|owner||owner:<name or group>
Note: Searches user accounts, group accounts and the .sow file.
|recommended||recommended:<'on' or 'off'>|
recommended:<'true' or 'false'>
Note: The 'recommended' keyword is used to filter by SmartRank issues. 'On/True' returns SmartRank issues. 'Off/False" shows issues not meeting the SmartRank threshold. Omitting this keyword returns both. For more information, see Using SmartRank to prioritize issues.
|severity||severity:<severity_name or severity_number>||severity:critical,4,error, 2-4|
|state (not supported for views)||state:<state_name>,<"state name">...||state:existing,fixed|
|status||status:<status_name>,<"statusname">||status:ignore,"fix in next release"|
|taxonomy||taxonomy:<taxonomy_name>,<"taxonomy name">||taxonomy:"MISRA C","MISRA C++"|
Items you want to exclude (-)
Preceding your search criteria (either keyword or text) with a minus sign indicates that you want to exclude issues by your specified criteria, for example:
This query excludes from the results all issues that have the code 'ABR' and "ANTLRParser" in the entity name, path, comment, code or owner.
Klocwork does not support using the minus sign with either the comment keyword or the state keyword.
Phrase search ("")
Use double quotes to indicate a phrase or expression that contains spaces or punctuation. For example:
comment:"needs more research"
Exact match (+)
Use the plus-sign to indicate an exact match is required for your full-text search. Example:
Clearing your search results
To clear your search results, clear the text field and click Search.
The OR operator
The default search behavior is to consider all keywords or text and list those issues that match all criteria. Use OR or "|" to override this behavior. This keyword is only supported for Klocwork Code Review. For example:
PR2777 OR PR2778
The above query will return items related to PR2777 and PR2778.
If you don't see the results that you're expecting to see
Check the selected view. Try switching to the default view.