Working with streams
As of Klocwork 2021.3, we've introduced a new feature that allows you to create multiple streams for a single code base, rather than needing to create a separate project for each variant. This provides the following benefits:
- You can assign a single project rule configuration to all variants
- Issues that are common to multiple variants are automatically kept in sync and only have to be cited once
- Reporting is possible for individual streams, as is necessary for compliance and functional safety reports
- Easier to identify identical issues that exist across multiple streams and unique issues that exist only within a specific stream
- More convenient organization and more efficient storage of analysis data
Example: Working on a code base with multiple versions
Let's say you are a car manufacturer and you have a main code base with multiple variants based on several models that you manufacture. The majority of the code remains the same across the different models, but may vary slightly such as having differing target platforms, branding or included modules. Previously, in order to be able to produce compliance reports for each individual variant, it would have been necessary to create a separate Klocwork project for each variant, and to synchronize citing data across projects for common issues in the shared code using kwxsync.
With this feature, you can simplify the process by having one core project, broken down into several streams. Visualizing the analysis data in streams allows you to quickly recognize an issue that is shared across streams, only cite and/or fix it once, and easily identify any unique issues for each individual stream.
How to create a stream
- Create your base project by selecting Create a new project from the Klocwork Portal.
- Next, create stream(s) related to your base project. Click on the project and a new window appears on the right; select Create stream.
- Enter a name for the stream; The Create as stream box and the Parent project fields are automatically populated. You may also add any relevant description and tags for the stream. When you are finished, click Create.
- Repeat steps 1-3 to create any additional streams. Note that you can also create a stream of a stream by selecting the stream from the project list and repeating these same steps.
Loading your builds to streams
Just as you can for your other projects, you can run an analysis and load the results to separate streams.
- Run Klocwork analysis on your source code using Kwbuildproject.
- Load the generated tables to the stream with Kwadmin load:
kwadmin load <path-to-stream> <tables_directory>Example:
kwadmin load myProj/variant1 tables
- Run analysis on the version of your source code for your other stream, and load it to the other stream with the command:
kwadmin load <path-to-other-stream> <tables_directory>Example:
kwadmin load myProj/myStream1/subVariant tables
Once you have loaded your builds to streams, you can select a project or any related streams from the projects list in the Portal to see a consolidated list of issues in the right side panel. This section displays the sum of all issues in the selected project, including all of its streams. Note that consolidated lists do not contain duplicate issues.
Citing issues on streams
Citing for identical issues is shared between a project and all of its streams. This eliminates the need to run kwxsync between streams to synchronize citing information. Simply cite an issue in your stream as you normally would for your base project; citing is automatically applied to this same issue in all other related streams.
What is a unique issue?
If an issue exists in at-most one stream, this issue is considered unique to the specific stream. This indicates that this issue was introduced in one of the stream's builds and is currently not in the state 'Fixed' in the latest build for the specified stream.
You can select the Hide streams check box to hide any streams in the projects list (and in Cross Project Report, if any were displayed there); this setting is persistent through your current browser session. You can still see information related to steams on the projects page by clicking on a base project and looking at the 'Streams' section in the right hand panel.
Deleting a stream
You can delete a stream by selecting the icon next to any stream in your projects list. Note that if you delete a stream or project that has children, those are also deleted.