awslabs / amazon-redshift-utils
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 469 units with 6,957 lines of code in units (60.0% of code).
    • 8 very long units (1,253 lines of code)
    • 21 long units (1,348 lines of code)
    • 58 medium size units (1,812 lines of code)
    • 88 small units (1,272 lines of code)
    • 294 very small units (1,272 lines of code)
18% | 19% | 26% | 18% | 18%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py18% | 19% | 26% | 16% | 18%
js0% | 19% | 11% | 55% | 14%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/SimpleReplay19% | 24% | 29% | 15% | 10%
src/AnalyzeVacuumUtility68% | 11% | 11% | 4% | 3%
src/ColumnEncodingUtility49% | 23% | 14% | 4% | 8%
src/MetadataTransfer0% | 35% | 50% | 13% | <1%
src/RedshiftAutomation0% | 45% | 43% | 8% | 2%
src/SystemTablePersistence0% | 47% | 26% | 17% | 8%
src/MultipleTableRestoreUtility0% | 42% | 22% | 17% | 17%
src/UserLastLogin0% | 80% | 0% | 19% | 0%
src/UnloadCopyUtility0% | 3% | 19% | 25% | 52%
src/SnapshotManager0% | 17% | 22% | 48% | 12%
src/UnloadAutoPartitions0% | 0% | 77% | 22% | 0%
src0% | 0% | 44% | 47% | 7%
src/WorkloadManagementScheduler0% | 0% | 40% | 33% | 26%
src/QMRNotificationUtility0% | 0% | 45% | 45% | 8%
src/BlogContent0% | 0% | 0% | 100% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def analyze()
in src/ColumnEncodingUtility/analyze-schema-compression.py
236 48 1
def run_analyze()
in src/AnalyzeVacuumUtility/lib/analyze_vacuum.py
199 19 10
def run_vacuum()
in src/AnalyzeVacuumUtility/lib/analyze_vacuum.py
195 29 12
def main()
in src/SimpleReplay/replay.py
174 34 0
def main()
in src/ColumnEncodingUtility/analyze-schema-compression.py
124 75 1
def save_logs()
in src/SimpleReplay/extract.py
119 25 6
def validate_config()
in src/SimpleReplay/replay.py
105 32 1
def validate_config_file()
in src/SimpleReplay/extract.py
101 25 1
def main()
in src/SimpleReplay/extract.py
95 15 0
def event_handler()
in src/RedshiftAutomation/lambda_function.py
90 36 2
def get_connection_string()
in src/SimpleReplay/replay.py
84 15 4
def snapshot()
in src/SystemTablePersistence/snapshot_system_stats.py
80 28 1
def start_replay()
in src/SimpleReplay/replay.py
72 25 10
def replay_worker()
in src/SimpleReplay/replay.py
71 20 10
def run_analyze_vacuum()
in src/AnalyzeVacuumUtility/lib/analyze_vacuum.py
69 11 1
def handler()
in src/SimpleReplay/cloudformation/LambdaReplay.py
67 17 2
def reduce_column_length()
in src/ColumnEncodingUtility/analyze-schema-compression.py
64 30 3
def parse_connections()
in src/SimpleReplay/replay.py
61 8 3
def deriveddls()
in src/MetadataTransfer/userprivs.py
60 26 2
def tablerestore()
in src/MultipleTableRestoreUtility/multitablerestore.py
58 14 5