Start here

Home
About Klocwork
What's new
Fixed issues
Release notes
Installation

Reference

C/C++ checkers
Java checkers
C# checkers
MISRA C 2004 checkers
MISRA C++ 2008 checkers
MISRA C 2012 checkers
MISRA C 2012 checkers with Amendment 1
Commands
Metrics
Troubleshooting
Reference

Product components

C/C++ Integration build analysis
Java Integration build analysis
Desktop analysis
Refactoring
Klocwork Static Code Analysis
Klocwork Code Review
Structure101
Tuning
Custom checkers

Coding environments

Visual Studio
Eclipse for C/C++
Eclipse for Java
IntelliJ IDEA
Other

Administration

Project configuration
Build configuration
Administration
Analysis performance
Server performance
Security/permissions
Licensing
Klocwork Static Code Analysis Web API
Klocwork Code Review Web API

Community

View help online
Visit RogueWave.com
Klocwork Support
Rogue Wave Videos

Legal

Legal information

As a committer

As a committer

As a committer, you are a software developer who creates and maintains software projects or source code in an SCM tool. You are responsible for configuring your SCM and submitting the code review, either before or after check-in. You are also responsible for inviting others to your code review. During the code review, you must maintain and monitor your feeds and collaborate with your reviewers to ensure that all comments, actions and reviews are handled accordingly. You will fix and resubmit rejected code reviews, taking care to ensure that your code has been thoroughly reviewed and tested.

Inviting participants to a code review

While it's not necessary to be invited to a code review in order to add comments and assign actions, inviting specific participants means that the code review will appear on their to do feed, and they'll be able to approve or reject the review.

If you're the creator of a code review or revision, or the Projects root admin, you'll see the Invite reviewer button on the right. Start typing in the text field, and auto-completion will suggest available user names.

You can tag a review to restrict access to it, to filter your feeds, or to search your list of reviews.

You can also invite reviewers when you set up a pre-checkin code review.

If you've already invited specific participants, their user names and avatars will appear below the Invite reviewer text field, along with one of three statuses:

  • pending
  • approved
  • rejected

Troubleshooting:

  • You only see the Invite reviewer field if you created the review.
  • If you want to invite a reviewer, that participant must already have logged in to Code Review, or must have submitted revisions to source control (in the case of a post-checkin review). Otherwise, you see the error message "Unknown user name".
  • It's possible that one or more participants may not have access to a project. If they see a message indicating "insufficient permissions" to view the code, they'll need to follow up with the Klocwork administrator.

Viewing file history

From your feed view or from the revision view, click history to see the history of a file from revision to revision, including comments or actions for the selected file. History is also available for files that were previously part of a pre-checkin review.

You can also compare a file with any revision in its history. Click at the top right-hand side of the diff view. Simply select the revision you would like to compare from the drop-down list and the previous revision will appear on the left with your current code on the right.

Viewing the diff for a revision

From your feed view or from the revision view, click a file link to open a diff for the file:

The diff provides the option of a side-by-side revision comparison or a merged view. The diff view displays markers on the right that allow you to navigate from one change to another.

Click Ignore W/S if you want to ignore formatting changes and only show changes that have been made to the code itself.

See the whole source file at once
Navigate from one file to another

From the diff view, you can:

  • make comments
  • assign actions
  • view and cite issues detected in the code
  • compare any revisions in the SCM revision history

Fixing and re-submitting your code review

If you previously submitted a code review but some of your reviewers rejected it, you can fix the issues and re-submit it for approval. All of the reviewers included in the initial code review will be carried forward automatically and re-notified once you submit your code review either through your IDE or on the command line.

Note: This functionality is only available when doing pre-checkin code reviews.

To submit a fixed code review in your IDE:

  1. Open the code review dialog.
    • Eclipse: Right-click the project or the file(s) you want to submit for a code review in the Project Explorer and select Create Code Review.
    • IntelliJ IDEA: Right-click the project or the file(s) you want to submit for a code review in the Project Tool window or the Changes Tool window (on the Local tab) and select Create Code Review.
    • Visual Studio: Right-click the solution, the project or the file(s) you want to submit for a code review in the Solution Explorer and select Create Code Review.
  2. The Create Code Review dialog appears.
  3. Enter the message that will appear with your code review in Code Review.
  4. Add one or more tags to the code review, if you want.
  5. In the Link to field, you need to specify the ID of the initial code review. The ID can be found in the title of your code review found within Klocwork Feeds page. For example, for 'pre-checkin code review 89754', 89754 is the ID.
    Note: You can only submit a fix for a code review once and you must be the original commiter; You are not able to submit fixed code review if you do not own it or if you do have the proper permissions.
  6. Once you’ve specified the code review to link to, all reviewers from original code review will be added automatically. You can add the names of additional reviewers, if you want.
  7. In the project tree, you can exclude files or directories from the selection (but only if you selected more than one file in step 2).
  8. Click OK.
To submit a fixed code review from the command line, you just need to use the kwcodereview command and specify the --fix option including the proper code review ID. Your command looks as follows:

Example

kwcodereview --url http://server01:8080/zlib --message "Fixed code review 47865" --fix "47865" --tags myTag1,myTag2 cvs /path/to/project

Investigating detected issues

You see detected issues and their traceback information in pre-checkin reviews if the code review was set up to allow this.

See What is Klocwork Code Review? for information on this feature.

Detected issues show up as "problems" in the feed:

In the code review, detected issues are displayed in a red box:

For each issue, you'll see:

  • status (only locally detected issues are shown). In the above image, the issue's status is "Analyze"
  • the previous statuses for this issue (its history)
  • the issue code, which is the short form of the issue type detected. In the above image, the issue code is UNREACH.GEN. You can get help on a specific issue by clicking
  • a description of the issue
  • the line number where the issue appears in the code. If you click the line: link, you see the diff view

Using traceback information to investigate a detected issue

Klocwork provides information about problematic statements that contributed to the detected issue, which we call "traceback".

To view traceback information for a detected issue, click trace:

You see markers and inline descriptions of events and conditions that led to the detected issue you're viewing. The marker appears above the line number, and the associated summary appears as a comment in red or blue text across from the marker. For example:

What the icons mean:

Trace condition
Trace event
Selected trace event

Navigating traceback

  • Click prev and next to navigate through the traceback conditions and events.
  • Click step into to see a more detailed view of a specific trace event.
  • To see the entire source file, click show full source at the top or bottom of the source viewer.

Traceback tree

If traceback identifies several lines of code, use the traceback tree to get an overview of all the events and conditions. Each line in the tree links directly to the source code and follows execution order.

Return to the diff view

To return to the diff view to assign actions or add comments, click the line number in the red box at the top of the view.

Changing an issue's status to show how it should be handled

After you investigate an issue, you can change its status. Issue statuses are a way of notifying others that you have reviewed the issue and made a recommendation about how it should be handled. It's a good idea to add a comment to provide more detail.

We call this process "issue citing".

  1. While viewing details for a particular detected issue, click the Status drop-down list in the left pane, and choose a status from the list.

  2. Click add comment and enter a comment to explain your change.
  3. Click Save. Your comment is displayed beside your user name.