facebookresearch / CPA
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 79 units with 2,290 lines of code in units (86.6% of code).
    • 2 very long units (229 lines of code)
    • 15 long units (997 lines of code)
    • 22 medium size units (725 lines of code)
    • 14 small units (204 lines of code)
    • 26 very small units (135 lines of code)
10% | 43% | 31% | 8% | 5%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py10% | 43% | 31% | 8% | 5%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
compert10% | 43% | 31% | 8% | 5%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def get_best_plots()
in compert/model_selection.py
128 11 2
def plot_dose_response()
in compert/plotting.py
101 15 15
def predict()
in compert/api.py
98 7 7
def plot_embedding()
in compert/plotting.py
97 15 22
def __init__()
in compert/model.py
91 4 11
def mean_plot()
in compert/plotting.py
88 19 16
def run_collect_results()
in compert/collect_results.py
64 18 3
def __init__()
in compert/data.py
63 5 6
def plot_contvar_response2D()
in compert/plotting.py
62 7 6
def plot_scatter()
in compert/plotting.py
59 7 9
def plot_contvar_response()
in compert/plotting.py
55 11 15
55 6 4
def train_compert()
in compert/train.py
55 15 2
def get_response()
in compert/api.py
54 11 9
def get_response2D()
in compert/api.py
53 9 11
def __init__()
in compert/api.py
52 10 3
def update()
in compert/model.py
51 3 4
def set_hparams_()
in compert/model.py
48 21 3
def plot_latent_embeddings()
in compert/plotting.py
46 7 9
def compute_comb_emb()
in compert/api.py
45 8 2