facebookresearch / anli
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 140 units with 2,472 lines of code in units (68.9% of code).
    • 2 very long units (600 lines of code)
    • 4 long units (343 lines of code)
    • 14 medium size units (436 lines of code)
    • 50 small units (719 lines of code)
    • 70 very small units (374 lines of code)
24% | 13% | 17% | 29% | 15%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py24% | 13% | 17% | 29% | 15%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/nli47% | 21% | 13% | 11% | 5%
src/modeling0% | 11% | 33% | 31% | 24%
src/flint0% | 0% | 27% | 59% | 13%
src/dataset_tools0% | 0% | 0% | 91% | 8%
src/utils0% | 0% | 0% | 47% | 52%
src/hg_api0% | 0% | 0% | 100% | 0%
src/flint/data_utils0% | 0% | 0% | 44% | 55%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def train()
in src/nli/training.py
303 46 2
def train()
in src/nli/training_extra.py
297 41 2
def main()
in src/nli/training.py
99 4 0
def evaluation()
in src/nli/evaluation.py
97 14 0
def main()
in src/nli/training_extra.py
82 4 0
def build_tf_xlnet_to_pytorch_map()
in src/modeling/dummy_modeling_xlnet.py
65 12 3
def load_tf_weights_in_xlnet()
in src/modeling/dummy_modeling_xlnet.py
50 16 3
def inference()
in src/nli/inference_debug.py
48 7 6
def pack_for_rnn_seq()
in src/flint/torch_util.py
45 10 4
def eval_model()
in src/nli/inference_debug.py
34 4 4
def eval_model()
in src/nli/training_extra.py
33 4 4
def eval_model()
in src/nli/training.py
33 4 4
def relative_positional_encoding()
in src/modeling/dummy_modeling_xlnet.py
29 7 4
def seq2seq_att()
in src/flint/torch_util.py
27 4 4
def __init__()
in src/modeling/res_encoder.py
25 3 11
def get_model_prediction()
in src/nli/inspection_tools.py
24 4 6
def _init_weights()
in src/modeling/dummy_modeling_xlnet.py
23 9 2
def __init__()
in src/modeling/dummy_modeling_xlnet.py
22 2 2
def prepare_inputs_for_generation()
in src/modeling/dummy_modeling_xlnet.py
22 4 4
def forward()
in src/modeling/res_encoder.py
21 6 4