facebookresearch / InvarianceUnitTests
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 40 units with 650 lines of code in units (75.1% of code).
    • 0 very long units (0 lines of code)
    • 2 long units (139 lines of code)
    • 9 medium size units (284 lines of code)
    • 7 small units (110 lines of code)
    • 22 very small units (117 lines of code)
0% | 21% | 43% | 16% | 18%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 21% | 43% | 16% | 18%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
scripts0% | 21% | 43% | 16% | 18%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def build_table()
in scripts/collect_results.py
77 17 6
def plot_nenvs_dimspu()
in scripts/plot_results.py
62 7 6
def run_experiment()
in scripts/main.py
46 8 1
def plot_table()
in scripts/plot_results.py
43 8 6
def plot_table_avg()
in scripts/plot_results.py
41 7 6
def print_table()
in scripts/collect_results.py
29 6 3
def process_results()
in scripts/plot_results.py
27 4 3
def __init__()
in scripts/datasets.py
26 5 4
def fit()
in scripts/models.py
25 7 4
def build_df()
in scripts/plot_results.py
24 4 1
def __init__()
in scripts/models.py
23 7 5
def fit()
in scripts/models.py
19 8 4
def __init__()
in scripts/datasets.py
17 5 4
def mask_step()
in scripts/models.py
16 4 6
def sample()
in scripts/datasets.py
16 2 4
def __init__()
in scripts/models.py
15 1 6
def sample()
in scripts/datasets.py
15 2 4
def fit()
in scripts/models.py
12 4 4
def __init__()
in scripts/models.py
10 1 5
def sample()
in scripts/datasets.py
10 2 4