amazon-research / generalized-fairness-metrics
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 274 units with 3,786 lines of code in units (61.7% of code).
    • 4 very long units (450 lines of code)
    • 6 long units (358 lines of code)
    • 40 medium size units (1,291 lines of code)
    • 60 small units (874 lines of code)
    • 164 very small units (813 lines of code)
11% | 9% | 34% | 23% | 21%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py11% | 8% | 36% | 24% | 18%
ts29% | 0% | 34% | 7% | 28%
tsx0% | 21% | 23% | 25% | 29%
js0% | 0% | 0% | 44% | 56%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
expanded_checklist/checklist10% | 12% | 36% | 25% | 15%
expanded_checklist/checklist/graphs49% | 0% | 23% | 18% | 8%
expanded_checklist/visual_interface/src12% | 12% | 28% | 17% | 29%
src/models/readers0% | 0% | 39% | 30% | 30%
src/models0% | 0% | 67% | 9% | 22%
expanded_checklist/checklist/viewer0% | 0% | 33% | 18% | 47%
ROOT0% | 0% | 34% | 51% | 14%
expanded_checklist/visual_interface/lib0% | 0% | 0% | 61% | 38%
expanded_checklist0% | 0% | 0% | 0% | 100%
src0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def plot_groups()
in expanded_checklist/checklist/graphs/graphs.py
134 30 8
export const suggests:()
in expanded_checklist/visual_interface/src/stores/FakeData.ts
111 1 1
def flatten_within_group()
in expanded_checklist/checklist/core_record.py
104 33 2
def multilingual_params()
in expanded_checklist/checklist/multilingual.py
101 4 2
def template()
in expanded_checklist/checklist/editor.py
80 41 11
def unmask()
in expanded_checklist/checklist/text_generation.py
61 18 4
public renderTable()
in expanded_checklist/visual_interface/src/components/suite_summarizer/SuiteSummarizer.tsx
57 7 0
public renderPerType()
in expanded_checklist/visual_interface/src/components/suite_summarizer/SuiteSummarizer.tsx
55 4 2
def accumulate_ner_probs()
in expanded_checklist/checklist/core_record.py
53 3 1
def add_negation()
in expanded_checklist/checklist/perturb.py
52 19 1
public computePreviewExamples()
in expanded_checklist/visual_interface/src/stores/templates/TemplateStore.ts
49 8 2
def perturb()
in expanded_checklist/checklist/perturb.py
48 15 6
def remove_negation()
in expanded_checklist/checklist/perturb.py
43 25 1
def _get_core_record()
in expanded_checklist/checklist/eval_core.py
42 10 2
def run_from_preds_confs()
in expanded_checklist/checklist/eval_core.py
41 9 7
def expand_contractions()
in expanded_checklist/checklist/perturb.py
40 2 2
public SuggestChecklist()
in expanded_checklist/visual_interface/src/components/template_editor/TokenSpan.tsx
40 5 0
def _merge_tokens_for_identity_term()
in expanded_checklist/checklist/core_record.py
39 6 6
def _get_fillin_items()
in expanded_checklist/checklist/editor.py
39 16 4
public render()
in expanded_checklist/visual_interface/src/components/template_editor/TemplateEditor.tsx
39 1 0