Customizing your view of the integration build analysis

From current

Klocwork Review > Customizing your view of the integration build analysis

Contents

This article explains how to set up views in Klocwork Review.

Note for users of previous versions: Scoping functionality has been removed in Klocwork Insight 9.5. Now, you control what you see in Klocwork Review issues and reports with views, as described in this article. If you're confused, see Help - I'm used to scoping in Klocwork Review.

All about views

Think of a view as a way to see exactly what you want to see in your project's defect analysis and reporting.

Generally, you don't want to see the entire analysis - you want to see only the defects in the code you're responsible for, or the most important defects, or how many defects have been fixed since the last analysis run. You probably also don't want to see defects in third-party code or test code.

You can easily set up multiple views for each of your projects and share them among your team.

A view is just a search string, comprised of one or more keywords and values. For example, if you want to view only defects of the highest severity, use this string to create a view:

severity:1

Once you set up a view, you can look at both detected issues and reports through that view.

In our example, when you go to Issues, you'll see only Severity 1 defects. And if you perform a search, for example for NPD, your search returns results only within the current view -- you'll see only Severity 1 NPD defects. The same holds true for reports: only the data from the current view is included in reports.

You can easily switch your view of the project at any time. In our example, if you switch to the default view, you'll now see NPD defects of all severities.

Views are project-specific. But since views are created with a simple search string, it's easy to set up the same view in multiple projects.

The default view

The default view shows everything: reports or lists of defects that include all severities, all taxonomies, all modules and all owners.

A project administrator can edit the default view for a project. You might want to do this if

  • you don't want anyone to bother with the results of the analysis for test files or third-party libraries (covered in Tutorial 2 below)
  • you want your team to focus only on the highest-severity defects
  • you want to exclude the analysis results of certain checkers from the default view

Public and shared views

Only project admins can make a view public, which will make it visible to all users who have access to that project.

But any user can share a view with another user. If Joe creates a view, he can click the share icon, copy the URL for that link, and send it to Liza; once Liza clicks this URL, the search appears in her Search list and she can save it. See also Saving your searches.

Or, Joe can request that a project admin make his view public.

If you delete a view you've created, whether you've shared it or not, it will be deleted for all users.

Supported keywords

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.

Keyword Format Example
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:

  • build:'123' - searches for build which contains substring '123'
  • build:+123 - searches for build with name 123
  • build:+'123string' - searches for build with name equal to '123string'

Tip: You can use the build:any keyword 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 FNH.MUST.

build:build_2 or build:beta
category category:<issue_category>,<issue_category>... category:"buffer overflow"
cited cited:'<time1>'-'<time2>'
Note: Acceptable time formats are 'yyyy-mm-dd hh:mm:ss' or 'yyyy-mm-dd'
cited:'2011-10-24 07:45:30'-'2011-11-24 21:30:00'
citedby citedby:<user_name> citedby:jsmith
code code:<issue_code>,<issue_code>...
code:NPD.GEN.MUST, npd.const.call
comment comment:<"issue comment">
Note: Use quotes for expressions that contain spaces or punctuation.
comment:"check with bob on this issue"
diff diff<build_1>,<build_2> diff:build_abc,build_def
entity entity:<entity_name>,<entity_name>... entity:get_file_type
file file:<filename>,<filename>... file:htmlparser
id id:<ID_number>,<ID_number>... id:33,59,149-160
line line:<line_number>,<line_number>... line:1-50,233
message message:<message_string> message:my_var
module module:<module_name> module:my_module
owner owner:<name or group>
Note: Searches user accounts, group accounts and the .sow file.
owner:smith,lee,devteam
reference reference:<ref_string>,<ref_string> reference:20,cast.ptr
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>,<"status_name"> status:ignore,"fix in next release"
taxonomy taxonomy:<taxonomy_name>,<"taxonomy name"> taxonomy:"MISRA C","MISRA C++"

Tutorial 1: Creating a view for a group of developers

Say you're a development manager and you want to monitor the activity of the group of developers you manage.

Note: This tutorial assumes that you:

First you create a user group for your developers. This isn't mandatory, because you can specify as many individual owners as you like in a view, but specifying a group just makes the view easier to maintain.

Create a user group

  1. Go to User Management by clicking Users at the top left.
    If you don't see Users, you likely don't have permissions to create accounts, so you'll need to contact your Klocwork administrator for this step.
  2. Click Create a new account next to Accounts.
  3. Make sure group is selected, enter a name for your group, and click OK.
    We'll call our new group Dev Team 2.
  4. Enter each developer's name in the text field and click Add. Suggestions will appear when you start typing.

Create a view for this group

  1. Go back to the Projects list by clicking Projects at the top left.
  2. Click the project you want to create a view for. The project details appear on the right.
  3. Click Views in the project details.
  4. Click Create a new view.
  5. Enter a name for your view. We'll call our new view Dev Team 2.
    View names cannot exceed 64 characters and cannot contain apostrophes (') or double quotes (").
  6. In the Search field, enter:
    owner:"Dev Team 2"
  7. Select public to make this view visible to all users who have access to this project.
    Only project admins can make a view public. But if you're not a project admin, you can still click share to share the view with your team.
  8. Click Create.

Test your new view

  1. Click the New or Open issues link for your new view.
  2. You'll see only issues owned by your team.

Tutorial 2: Excluding issues in test code from view

If your project contains test code, you likely don't want your developers to worry about issues detected in that code. You can create a module for the directories containing the test code and then edit the default view to exclude the module.

Create a module for the test code

  1. If you're not already viewing the Projects list, click Projects at the top left.
  2. Click your project in the list. The project details appear.
  3. Click Modules in the project details.
  4. Click Create a new module.
  5. In the Module name field, enter Test Code.
  6. If access control has been set up, you will see additional fields related to permissions; just leave the defaults, because you don't need to worry about who has access to test code.
  7. In the Path patterns field, enter the absolute path to your source files, or a path pattern.
    Tip: You can use asterisks as wildcards (necessary if the path to your source files changes from build to build). A single asterisk matches one directory level; two asterisks match any part of a path. For example:
    */test/*
    **/test/*
  8. Click add if you want to add more file paths to this module.
  9. Use the tags field to add information that will be helpful for filtering later.
  10. Click Create to save your new module.

For more details on creating modules, see Organizing your code into modules.

Edit the default view

  1. Go back to the Projects list by clicking Projects at the top left.
  2. Click the project you want to edit.
  3. The project details appear on the right. Click Views in the project details.
  4. Click the Edit delete projects.png edit icon to the left of the view labeled *default*.
  5. In the Search field, enter:
    -module:"Test Code"
  6. Click Save.

Test the default view

  1. Click the New or Open issues link for the default view.
  2. You should not see issues found in code that's part of the Test Code module.

See also