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

Function- and method-level metrics

Name Description Metric code ID Languages
Lines of code number of lines of code in the method or function; calculated as (last line number) - (first line number) + 1 LOC_METHOD 129 C/C++, Java
Number of operands used An operand is an identifier or a constant. This metric calculates the total number of identifiers and constants used in the function or method. Note that a method name is also an identifier. For this metric, a function call is considered an operator. NOOPUSED 130 C/C++, Java
Number of distinct operands used number of unique operands (variables and constants) used in the current function. Variables are distinguished by name, so usages of overridden variables do not contribute to this metric. Constants are distinguished by value, so all strings are assumed to be unique. For this metric, a function call is considered an operator. NODISOPUSED 131 C/C++, Java
Number of operators used number of operators used in the function or method. This metric counts the total number of accesses to variable, binary, ternary, unary, field access, index access, call, new instance of, expr-class, expression-this, and expression-super. All function calls are considered as operators. NOOPRUSED 132 C/C++, Java
Number of distinct operators used number of unique operators used in the function. Like NOOPRUSED, but function calls are considered as one unique operator. For example, Msg and printf function calls are counted only once. NODISOPRUSED 133 C/C++, Java
Number of returns number of return statements in the function (not return points) NORET 134 C/C++, Java
Cyclomatic complexity cyclomatic complexity (McCabe Cyclomatic Complexity metric) shows the number of areas plane is divided by control flow graph CYCLOMATIC 135 C/C++, C#, Java
Number of independent paths the output value is (log_e) (number of paths within function/method). All loops and if-statements are considered as two independent paths. Goto statements in C++ are not taken into consideration in this calculation. Each catch clause is an independent path. NOINDPATHS 136 C/C++, Java
Number of parameters number of parameters (arguments) in the function or method. In this example f(x,y+z, foo (g)) x, y+z, and g are parameters passed to other functions so the number would be 3. NOPARMS 137 C/C++, C#, Java
Number of calls to unique functions the number of calls from function or methods (for which metrics are calculated) to other functions or methods. Any number of calls to the same function or method adds only one to this metric. NOCALLS 138 C/C++, Java
Number of calls outside the class number of calls outside the class (number of calls to methods with different "this"): For a method, this metric is equal to the total number of calls minus the number of calls to other methods of the same class (including self). For a function that is not a method, this metric is equal to the total number of calls. NOCALLSOC 139 C/C++, Java
Number of parameters passed to other functions number of parameters passed to other functions. In this example, foo (int i) { bar (1, 2, 3); 700 (1); } the number is 4 NOPAROTHER 140 C/C++, Java
Number of executable statements number of executable and blank statements in the function or method. An executable statement is an operator such as a+=b; or a function call such as f(s+y, z). NOEXSTAT 141 C/C++, Java
Number of statements number of expression and control statements (if, for, while). This metric is the sum of NOCONTROLSTAT, NOEXSTAT, and NOMDECLSTAT for the function or method. NOSTAT 142 C/C++, Java
Number of loops number of for, while, and do-while statements in the current function NOLOOPS 143 C/C++, Java
Number of conditional statements number of if and switch statements in the current function NOIF 144 C/C++, Java
Number of else and case statements number of else and case statements in the current function. Default statements are not included. NOBRANCH 145 C/C++, Java
Maximum level of control nesting maximum level of nested control statements (if, switch, for, while, and do-while statements). The initial MAXLEVEL (for example, a function with no operators) is equal to 1. MAXLEVEL 146 C/C++, C#, Java
Average level of control nesting average number of executable statements in a function or method; calculated as the sum of the level of each executable statement for all statements in the function divided by the number of executable statements. If the number of executable statements is 0, AVERLEVEL is 0. AVERLEVEL 147 C/C++, Java
Number of local declarations number of data items declared locally within the function NOLOCDECL 148 C/C++, Java
Maximum number of executable statements in a conditional arc maximum number of executable statements located within the span of a branch of a conditional arc MAXCONDSPAN 149 C/C++, Java
Number of conditional arcs in the control graph of the function or method number of conditional branches in the control graph of the function or method (if, switch, do, while, or for statements) NOCONDARCS 150 C/C++, Java
Number of control statements in the function or method number of control statements (statements that operated control flow within a function or method). This metric calculates the number of loops or conditional statements (if, switch, do, while, for), plus the number of control-passing statements (return, break, continue, goto), plus the number of try-catch statements. NOCONTROLSTAT 151 C/C++, Java
Number of declarative statements in the function or method number of declarative statements in the function or method; for example, the declaration of a local array or a local variable. This differs from NOLOCDECL because 1 declaration statement can declare several local variables. NOMDECLSTAT 152 C/C++, Java
Number of accesses to global variables number of accesses (reads/writes) to variables defined outside the function or method NOACCTOGLOB 153 C/C++, Java
Bytes of local variables declared For more information about calculating this metric, see Specifying sizes for built-in types. BYTESLOCDECL 154 C/C++
Bytes of parameters for the function For more information about calculating this metric, see Specifying sizes for built-in types. BYTESPARMS 155 C/C++
Bytes of parameters passed to other functions For more information about calculating this metric, see Specifying sizes for built-in types. BYTESPAROTHER 156 C/C++
Number of calls to non-prototyped functions number of calls to non-prototyped functions. This metric depends on the completeness of the code. If code is compiled without includes, the metric would be only the number of calls (because no functions would be prototyped). NOCALLSNP 159 C/C++
Number of reads from global variables Number of reads from global variables READFGLOBAL 160 C/C++, Java
Number of writes to global variables Number of writes to global variables WRITETGLOBAL 161 C/C++, Java
Non-comment, non-blank lines of code in the function or method the number of lines of code in a function or method, not including comment lines and blank lines NCNBLOC_METHOD 162 C/C++, C#, Java
Extended cyclomatic complexity Extended cyclomatic complexity includes logical Boolean operators in the decision count. Whenever Klocwork finds a logical Boolean operator (&& or |) within a conditional statement, EXTCYCLOMATIC increases by one. The conditionals Klocwork considers are: If, IfElse, While, DoWhile, For and Switch. EXTCYCLOMATIC 164 C/C++
Plain cyclomatic complexity Like Cyclomatic complexity (metric code 135), but is calculated on plain code (before preprocessor expansion). Any conditional statements generated from macro definitions do not result in PLAINCYCLOMATIC metric. PLAINCYCLOMATIC 165 C/C++
Plain extended cyclomatic complexity Like Extended cyclomatic complexity (metric code 164), but is calculated on plain code (before preprocessor expansion). Any conditional statements generated from macro definitions do not result in PLAINEXTCYCLOMATIC metric. PLAINEXTCYCLOMATIC 166 C/C++