Tutorial 1 - Introducing Checker Studio
From current
Custom checkers > Tutorial 1 - Introducing Checker Studio
Contents |
Checker Studio is where you:
- browse the Abstract Syntax Tree (AST) structure of your code sample
- view context-sensitive help for specific AST nodes of interest
- navigate between the code sample and the AST structure
- test your KAST expression
The following tutorial provides an overview of how to add a test case (code snippet) to Checker Studio, browse the AST structure and test a KAST expression (pattern).
Step 1: Browse the Abstract Syntax tree
- Double-click the Checker Studio icon on your desktop or on the command line, type:
-
kwstudio
-
- Make sure that the appropriate language is selected (C, C++, or Java).
- Paste your code snippet into the Source Code pane. Later, you'll add the code snippet to your testcase.cc file.
- If you don't see the Abstract Syntax Tree display immediately to the left, click Update Tree
or Automatic Tree Update
.
- Note: If the Update Tree button is disabled, then Automatic Tree Update is enabled.
- Navigate the AST by:
- clicking a node in the AST to see the corresponding code fragment highlighted, or
- clicking a code fragment to see the corresponding node highlighted in the AST.
- To view context-sensitive help, either select a tree node and press F1 or go to View > Context Help Window. Context-sensitive help displays below the Source Code pane, providing more node information such as supertypes and subtypes where applicable.
- To view attributes in the Attributes table, click Show/Hide Attributes
.
Step 2: Test your KAST expression
Once you have identified your nodes of interest from your test case, you can create and test a KAST expression in Checker Studio.
- Type or paste your KAST expression in the Pattern pane.
- Click Apply Pattern
.
- If further edits are required, update the KAST expression and apply it again. If the KAST expression passes the test, you can:
- add the expression to the checkers.xml file, or
- create false-positive test cases to ensure that the checker does not generate errors for certain conditions, or
- create more complex test cases, or
- draft another KAST expression
Documentation for custom C/C++ checkers
Overview
How-to
Tutorials
- KAST tutorials
- Tutorial 1 - Introducing Checker Studio
- Tutorial 2 - Creating a C/C++ KAST checker
- Tutorial 3 - Creating a C/C++ KAST checker with custom functions
- Path tutorials
Examples
Deployment
Reference


