aws / telegraf
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 5,215 units with 104,171 lines of code in units (76.0% of code).
    • 2 very complex units (28,812 lines of code)
    • 34 complex units (3,683 lines of code)
    • 268 medium complex units (15,660 lines of code)
    • 580 simple units (17,932 lines of code)
    • 4,331 very simple units (38,084 lines of code)
27% | 3% | 15% | 17% | 36%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
go27% | 3% | 15% | 17% | 36%
py0% | 57% | 0% | 15% | 26%
c0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
plugins33% | 2% | 14% | 16% | 33%
patches0% | 8% | 20% | 20% | 51%
scripts0% | 57% | 0% | 15% | 26%
cmd0% | 33% | 20% | 28% | 16%
metric0% | 22% | 0% | 0% | 77%
agent0% | 0% | 20% | 21% | 57%
internal0% | 0% | 11% | 33% | 54%
models0% | 0% | 10% | 22% | 67%
config0% | 0% | 23% | 28% | 48%
testutil0% | 0% | 8% | 0% | 91%
logger0% | 0% | 0% | 38% | 61%
selfstat0% | 0% | 0% | 18% | 81%
filter0% | 0% | 0% | 29% | 70%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
func()
in plugins/parsers/influx/machine.go
28385 10050 1
func NewStatLine()
in plugins/inputs/mongodb/mongostat.go
427 104 5
func()
in patches/gopsutil/process/process_linux.go
167 50 1
func PlatformInformationWithContext()
in patches/gopsutil/host/host_linux.go
122 46 1
func convertField()
in metric/metric.go
97 46 1
func()
in plugins/parsers/grok/parser.go
160 46 1
func fillFromMeminfoWithContext()
in patches/gopsutil/mem/mem_linux.go
112 44 1
def package()
in scripts/build.py
123 43 7
func fieldConvert()
in plugins/inputs/snmp/snmp.go
107 41 2
func()
in plugins/inputs/tengine/tengine.go
176 37 1
func()
in plugins/outputs/prometheus_client/v1/collector.go
158 37 1
func CgroupMemWithContext()
in patches/gopsutil/docker/docker_linux.go
91 36 3
func Write()
in patches/gopsutil/internal/common/binary.go
103 35 3
func VirtualizationWithContext()
in patches/gopsutil/internal/common/common_linux.go
100 34 1
func()
in plugins/inputs/mysql/mysql.go
105 34 1
func()
in plugins/inputs/procstat/procstat.go
129 34 1
func()
in plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go
86 34 1
def main()
in scripts/build.py
104 34 1
func()
in plugins/inputs/statsd/statsd.go
112 33 1
func()
in plugins/inputs/snmp/snmp.go
102 32 1