facebookresearch / selavi
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 144 units with 2,614 lines of code in units (57.8% of code).
    • 3 very long units (466 lines of code)
    • 10 long units (708 lines of code)
    • 17 medium size units (508 lines of code)
    • 29 small units (433 lines of code)
    • 85 very small units (499 lines of code)
17% | 27% | 19% | 16% | 19%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py19% | 26% | 20% | 15% | 18%
js0% | 42% | 0% | 32% | 24%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT27% | 27% | 14% | 13% | 17%
src20% | 23% | 29% | 7% | 18%
datasets0% | 28% | 15% | 32% | 23%
cluster_vis/data0% | 42% | 0% | 32% | 24%
cluster_vis0% | 0% | 90% | 0% | 9%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in finetune_video.py
210 26 2
def main()
in main.py
152 15 0
def cluster()
in src/sk_utils.py
104 13 9
def parse_args()
in finetune_video.py
97 3 0
84 3 0
def __getitem__()
in datasets/AVideoDataset.py
80 19 2
def train()
in main.py
74 11 6
def _construct_loader()
in datasets/AVideoDataset.py
73 16 1
function showCluster()
in cluster_vis/data/clustervis.js
69 6 1
def parse_args()
in src/retrieval_utils.py
64 3 0
def parse_args()
in get_clusters.py
58 3 0
def evaluate()
in finetune_video.py
55 8 5
def optimize_L_sk_gpu()
in src/sk_utils.py
54 14 4
def get_model()
in src/retrieval_utils.py
47 9 3
def match_order()
in src/sk_utils.py
40 10 7
def init()
in src/retrieval_utils.py
39 1 3
def get_clusters()
in cluster_vis/get_clusters_kinetics.py
33 5 2
def get_clusters()
in cluster_vis/get_clusters_vggsounds.py
33 5 2
def __init__()
in datasets/AVideoDataset.py
31 1 0
def main()
in video_retrieval.py
31 2 2