facebookresearch / PyTouch
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 230 units with 1,743 lines of code in units (58.1% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 11 medium size units (314 lines of code)
    • 39 small units (549 lines of code)
    • 180 very small units (880 lines of code)
0% | 0% | 18% | 31% | 50%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 0% | 18% | 30% | 50%
js0% | 0% | 0% | 100% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
train/models0% | 0% | 28% | 33% | 37%
train/datamodules0% | 0% | 55% | 0% | 44%
pytouch/tasks0% | 0% | 16% | 39% | 44%
pytouch/datasets0% | 0% | 19% | 32% | 47%
train0% | 0% | 100% | 0% | 0%
pytouch/models0% | 0% | 12% | 33% | 54%
pytouch/utils0% | 0% | 0% | 27% | 72%
pytouch/common0% | 0% | 0% | 36% | 63%
pytouch/handlers0% | 0% | 0% | 37% | 62%
website/src0% | 0% | 0% | 100% | 0%
pytouch/sensors0% | 0% | 0% | 18% | 81%
ROOT0% | 0% | 0% | 37% | 62%
pytouch0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in train/train.py
45 2 1
def _make_layer()
in pytouch/models/slip_resnet.py
38 5 6
def _make_layer()
in train/models/slip_resnet.py
38 5 6
def setup()
in train/datamodules/touch_detect.py
29 1 2
def point_cloud_3d()
in pytouch/tasks/surface_3d.py
28 4 4
def setup()
in train/datamodules/slip_detect.py
25 2 2
def _compute_contact_area()
in pytouch/tasks/contact_area.py
24 3 3
def __getitem__()
in pytouch/datasets/slip_sequence.py
23 5 2
def _get_sensors()
in pytouch/datasets/sensors.py
22 6 3
def validation_step()
in train/models/slip_detect.py
21 1 3
def validation_step()
in train/models/touch_detect.py
21 1 3
def resize()
in pytouch/handlers/video.py
20 6 3
def transform()
in pytouch/tasks/slip_detect.py
19 3 2
def __call__()
in pytouch/tasks/contact_area.py
19 4 3
def _get_digits()
in pytouch/datasets/digit.py
19 6 3
def normal_to_grad_depth()
in pytouch/tasks/surface3d/geometry.py
18 2 4
def _forward_impl()
in pytouch/models/slip_resnet.py
18 1 2
def _forward_impl()
in train/models/slip_resnet.py
18 1 2
def _pixel_to_clip()
in pytouch/tasks/surface3d/geometry.py
16 1 3
def _get_slip_labels()
in pytouch/datasets/slip_sequence.py
16 6 2