facebookresearch / ELF
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 1,594 units with 14,433 lines of code in units (68.9% of code).
    • 0 very complex units (0 lines of code)
    • 6 complex units (563 lines of code)
    • 45 medium complex units (1,734 lines of code)
    • 127 simple units (2,949 lines of code)
    • 1,416 very simple units (9,187 lines of code)
0% | 3% | 12% | 20% | 63%
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
cc0% | 8% | 21% | 23% | 46%
py0% | 1% | 6% | 21% | 69%
h0% | 0% | 3% | 14% | 81%
js0% | 0% | 20% | 14% | 65%
hh0% | 0% | 0% | 9% | 90%
cpp0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
rts/engine0% | 6% | 13% | 21% | 58%
rts/game_MC0% | 8% | 18% | 11% | 61%
ROOT0% | 22% | 0% | 18% | 58%
go0% | 3% | 25% | 23% | 47%
rts/backend0% | 12% | 21% | 15% | 50%
elf_python0% | 0% | 13% | 33% | 52%
rts/game_CF0% | 0% | 11% | 14% | 74%
rts/frontend0% | 0% | 20% | 14% | 65%
rlpytorch/utils0% | 0% | 14% | 27% | 57%
elf/lib0% | 0% | 21% | 14% | 64%
elf0% | 0% | 1% | 22% | 76%
atari0% | 0% | 2% | 28% | 69%
rts/game_TD0% | 0% | 2% | 25% | 71%
rlpytorch0% | 0% | 0% | 16% | 83%
rlpytorch/runner0% | 0% | 0% | 20% | 79%
rlpytorch/methods0% | 0% | 0% | 13% | 86%
rlpytorch/trainer0% | 0% | 0% | 11% | 88%
rlpytorch/sampler0% | 0% | 0% | 25% | 74%
rlpytorch/stats0% | 0% | 0% | 7% | 92%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
cc
bool RuleActor::act_per_unit()
in rts/engine/rule_actor.cc
89 44 6
cc
bool MCRuleActor::ActByState()
in rts/game_MC/mc_rule_actor.cc
113 31 4
cc
RawMsgStatus RawToCmd::Process()
in rts/backend/raw2cmd.cc
75 31 5
cc
bool Player::PathPlanning()
in rts/engine/player.cc
113 30 8
def prompt()
in df_console.py
87 28 3
86 27 4
cc
EntryInfo EntryFunc()
in rts/game_MC/python_wrapper.cc
24 25 1
65 24 3
def feed()
in rlpytorch/utils/utils.py
32 24 4
cc
61 22 2
cc
void MCExtractor::extract()
in rts/game_MC/state_feature.cc
82 22 4
cc
bool RTSMap::GenerateTDMaze()
in rts/engine/map.cc
62 21 1
50 19 2
cc
void VerifyBoard()
in go/board.cc
73 19 1
def read_cmd_def()
in rts/engine/compile_cmds.py
45 19 3
cc
bool CFRuleActor::FlagActByState()
in rts/game_CF/cf_rule_actor.cc
49 18 3
cc
bool MergeToGroup()
in go/board.cc
19 17 3
EntryInfo EntryFunc()
in go/game_context.h
14 16 1
cc
bool Play()
in go/board.cc
63 16 2
cc
EntryInfo EntryFunc()
in rts/game_CF/python_wrapper.cc
11 16 1