awslabs / sagemaker-battlesnake-ai
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 470 units with 7,163 lines of code in units (79.9% of code).
    • 2 very long units (273 lines of code)
    • 20 long units (1,327 lines of code)
    • 89 medium size units (2,717 lines of code)
    • 104 small units (1,539 lines of code)
    • 255 very small units (1,307 lines of code)
3% | 18% | 37% | 21% | 18%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py3% | 18% | 37% | 21% | 18%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
source/RLlibEnv/training3% | 20% | 33% | 20% | 22%
source/BattlesnakeGym/battlesnake_gym11% | 9% | 43% | 20% | 15%
source/MXNetEnv/training0% | 24% | 57% | 12% | 5%
source/RLlibEnv0% | 60% | 21% | 15% | 1%
source/MXNetEnv0% | 34% | 41% | 18% | 6%
source/RLlibEnv/inference0% | 0% | 51% | 36% | 11%
source/MXNetEnv/inference0% | 0% | 62% | 35% | 2%
deployment/LambdaGateway/src0% | 0% | 21% | 63% | 14%
source0% | 0% | 0% | 100% | 0%
deployment/CloudFormation/solution-assistant0% | 0% | 0% | 66% | 33%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def get_cloudwatch_dashboard_json_for_experiment_id()
in source/RLlibEnv/training/common/sagemaker_rl/orchestrator/utils/cloudwatch_logger.py
158 1 3
def step()
in source/BattlesnakeGym/battlesnake_gym/snake_gym.py
115 37 3
def _did_snake_collide()
in source/BattlesnakeGym/battlesnake_gym/snake_gym.py
90 29 3
def evaluate_model()
in source/RLlibEnv/training/common/sagemaker_rl/orchestrator/workflow/manager/experiment_manager.py
83 27 4
def __init__()
in source/RLlibEnv/training/training_src/cnn_tf.py
78 6 6
def _update_experiment_db_hosting_workflow_metadata()
in source/RLlibEnv/training/common/sagemaker_rl/orchestrator/workflow/manager/experiment_manager.py
77 19 2
def deploy_model()
in source/RLlibEnv/training/common/sagemaker_rl/orchestrator/workflow/manager/experiment_manager.py
76 32 4
def __init__()
in source/RLlibEnv/training/common/sagemaker_rl/orchestrator/workflow/manager/experiment_manager.py
72 11 7
def trainer()
in source/MXNetEnv/training/training_src/dqn_run.py
71 25 17
def simulate()
in source/RLlibEnv/heuristics_utils.py
69 14 5
def __init__()
in source/RLlibEnv/training/common/sagemaker_rl/orchestrator/workflow/manager/model_manager.py
69 8 21
def train_next_model()
in source/RLlibEnv/training/common/sagemaker_rl/orchestrator/workflow/manager/experiment_manager.py
67 25 4
def initialize_first_model()
in source/RLlibEnv/training/common/sagemaker_rl/orchestrator/workflow/manager/experiment_manager.py
65 21 3
def simulate()
in source/MXNetEnv/heuristics_utils.py
62 8 4
def act()
in source/MXNetEnv/training/training_src/networks/agent.py
60 11 7
def join()
in source/RLlibEnv/training/common/sagemaker_rl/orchestrator/workflow/manager/experiment_manager.py
58 16 5
def __init__()
in source/RLlibEnv/training/common/sagemaker_rl/orchestrator/workflow/manager/join_manager.py
57 15 13
def __init__()
in source/MXNetEnv/training/training_src/networks/qnetworks.py
56 2 12
def _update_model_table_evaluation_states()
in source/RLlibEnv/training/common/sagemaker_rl/orchestrator/workflow/manager/model_manager.py
56 14 1
def _update_experiment_db_training_workflow_metadata()
in source/RLlibEnv/training/common/sagemaker_rl/orchestrator/workflow/manager/experiment_manager.py
55 15 2