JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.
If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.
If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.
| CodeSonar® 9.2p0 | CONFIDENTIAL | CodeSecure Inc |
A procedure's cyclomatic complexity is greater than 20.
| Class Name | High Cyclomatic Complexity (Procedure) | ||||||
|---|---|---|---|---|---|---|---|
| Significance | style | ||||||
| Mnemonic | LANG.METRIC.VG_P | ||||||
| Categories |
|
||||||
| Availability | Available for C and C++. |
||||||
| Enabling | Checks for this warning class are
disabled by default. To enable them, add the following WARNING_FILTER
rule to the project configuration file.
WARNING_FILTER += allow class="High Cyclomatic Complexity (Procedure)" |
static int low_cyclomatic_complexity(int i) { // ok: cyclomatic complexity <20
int rv = 0;
if (i) {
rv = 1;
}
return rv;
}
// 'High Cyclomatic Complexity (Procedure)' warning issued on following line
// - cyclomatic complexity of this procedure is >20
static int high_cyclomatic_complexity(int a, int b, int c, int d, int e) {
int rv = 0;
if (a) {
rv += 1;
if (b) {
rv += 1;
if (c) {
rv +=1;
if (d) {
rv +=1;
if (e) { rv += 1; }
else { rv -= 1; }
}
else {
rv -= 1;
if (e) { rv += 1; }
else { rv -= 1; }
}
}
else {
rv -=1;
if (d) {
rv +=1;
if (e) { rv += 1; }
else { rv -= 1; }
}
else {
rv -= 1;
if (e) { rv += 1; }
else { rv -= 1; }
}
}
}
else {
rv -= 1;
if (c) {
rv +=1;
if (d) {
rv +=1;
if (e) { rv += 1; }
else { rv -= 1; }
}
else {
rv -= 1;
if (e) { rv += 1; }
else { rv -= 1; }
}
}
else {
rv -=1;
if (d) {
rv +=1;
if (e) { rv += 1; }
else { rv -= 1; }
}
else {
rv -= 1;
if (e) { rv += 1; }
else { rv -= 1; }
}
}
}
}
else {
rv -= 1;
if (b) {
rv += 1;
if (c) {
rv +=1;
if (d) { rv +=1; }
else { rv -=1; }
}
else { rv -=1; }
}
else {
rv -= 1;
if (c) { rv +=1; }
else { rv -=1; }
}
}
return rv;
}
This class is implemented using a METRIC_WARNING_* rule set in the general template configuration file.
To adjust the triggering condition for this class, edit the corresponding METRIC_WARNING_CONDITION.
The following configuration file parameters affect checks for this warning class.
To report problems with this documentation, please visit https://support.codesecure.com/.