facebookresearch / nle
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 1,070 units with 19,266 lines of code in units (6.0% of code).
    • 20 very long units (4,239 lines of code)
    • 53 long units (3,738 lines of code)
    • 156 medium size units (4,986 lines of code)
    • 218 small units (3,126 lines of code)
    • 623 very small units (3,177 lines of code)
22% | 19% | 25% | 16% | 16%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c28% | 26% | 23% | 13% | 7%
cpp18% | 13% | 26% | 16% | 25%
py8% | 14% | 33% | 22% | 20%
js0% | 0% | 67% | 23% | 8%
pm0% | 0% | 30% | 48% | 20%
pl0% | 0% | 12% | 64% | 22%
h0% | 0% | 0% | 0% | 100%
cc0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src51% | 22% | 17% | 6% | 3%
win/Qt421% | 15% | 22% | 13% | 26%
win/Qt15% | 10% | 30% | 18% | 25%
sys/vms65% | 0% | 16% | 15% | 1%
sys/wince30% | 9% | 12% | 21% | 26%
nle/agent35% | 10% | 14% | 13% | 25%
sys/winnt0% | 48% | 26% | 16% | 8%
sys/share0% | 23% | 33% | 27% | 15%
nle/scripts0% | 24% | 39% | 24% | 10%
win/X110% | 59% | 35% | 5% | 0%
sys/amiga0% | 51% | 43% | 0% | 4%
win/curses0% | 62% | 30% | 0% | 6%
util0% | 57% | 0% | 27% | 14%
win/win320% | 25% | 42% | 4% | 27%
sys/msdos0% | 17% | 46% | 32% | 2%
nle/env0% | 0% | 44% | 26% | 28%
sys/mac0% | 0% | 49% | 19% | 30%
win/tty0% | 0% | 40% | 59% | 0%
nle/dashboard0% | 0% | 67% | 23% | 8%
DEVEL/hooksdir0% | 0% | 30% | 48% | 20%
ROOT0% | 0% | 92% | 0% | 7%
win/gem0% | 0% | 55% | 44% | 0%
DEVEL0% | 0% | 26% | 64% | 8%
nle/nethack0% | 0% | 0% | 41% | 58%
win/share0% | 0% | 0% | 65% | 34%
win/gnome0% | 0% | 0% | 100% | 0%
win/rl0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
1182 521 1
HUP raw_printf()
in src/files.c
273 61 2
help_requested ?()
in src/cmd.c
246 68 1
int FDECL()
in src/zap.c
238 121 1
int __cdecl fscanf()
in sys/wince/celib.c
195 66 3
184 43 6
def train()
in nle/agent/agent.py
170 26 1
char NetHackQtYnDialog::Exec()
in win/Qt/qt_win.cpp
162 56 0
char NetHackQtYnDialog::Exec()
in win/Qt4/qt4yndlg.cpp
161 45 0
160 2 3
149 36 0
147 28 0
extern void FDECL()
in sys/vms/vmsmain.c
135 23 2
133 41 0
131 33 1
122 28 1
120 32 1
void QtTableView::paintEvent()
in win/Qt/qttableview.cpp
114 33 1
114 47 5
103 35 2