facebookresearch / salina
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 692 units with 8,479 lines of code in units (70.2% of code).
    • 0 very complex units (0 lines of code)
    • 2 complex units (126 lines of code)
    • 8 medium complex units (917 lines of code)
    • 36 simple units (2,447 lines of code)
    • 646 very simple units (4,989 lines of code)
0% | 1% | 10% | 28% | 58%
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
py0% | 1% | 10% | 28% | 58%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
salina_cl/algorithms0% | 5% | 49% | 0% | 44%
salina_examples0% | 100% | 0% | 0% | 0%
salina_examples/rl0% | 0% | 4% | 38% | 57%
salina_examples/offline_rl0% | 0% | 6% | 56% | 37%
salina/rl0% | 0% | 45% | 0% | 54%
salina0% | 0% | 4% | 6% | 88%
salina/agents0% | 0% | 3% | 21% | 75%
salina_examples/computer_vision0% | 0% | 0% | 64% | 35%
salina_cl/scenarios0% | 0% | 0% | 13% | 86%
salina_cl0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def weight_init()
in salina_examples/__init__.py
63 30 1
def weight_init()
in salina_cl/algorithms/tools.py
63 30 1
def ppo_train()
in salina_cl/algorithms/ppo_finetune/ppo.py
154 21 7
def sac_train()
in salina_cl/algorithms/sac_finetune/sac.py
218 20 9
def td3_train()
in salina_cl/algorithms/td3_finetune/td3.py
205 20 8
def d4rl_episode_buffer()
in salina_examples/offline_rl/d4rl.py
62 15 1
def _format_frame()
in salina/agents/gyma.py
34 14 1
def read_log()
in salina/logger.py
39 13 3
def run_ppo()
in salina_examples/rl/ppo_brax/ppo.py
148 13 4
def put()
in salina/rl/replay_buffer.py
57 11 4
def forward()
in salina/agents/xformers_transformers.py
35 10 3
def run_ddpg()
in salina_examples/rl/ddpg/ddpg.py
144 10 4
def run_ppo()
in salina_examples/rl/ppo_brax_transformer/ppo.py
127 10 4
def run_dqn()
in salina_examples/rl/dqn/double_dqn/dqn.py
113 10 3
def run_td3()
in salina_examples/rl/td3/td3.py
188 10 5
def run_td3()
in salina_examples/rl/td3/td3_with_brax.py
181 10 5
def run_bc()
in salina_examples/offline_rl/decision_transformer/dt.py
115 9 5
def forward()
in salina_examples/offline_rl/decision_transformer/agents.py
49 9 4
def run_ppo()
in salina_examples/rl/ppo_continuous/ppo.py
113 9 4
def run_a2c()
in salina_examples/rl/a2c/complete_with_async_eval/main.py
126 9 3