microsoft / vscode-arduino
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 478 units with 5,694 lines of code in units (71.0% of code).
    • 2 very long units (573 lines of code)
    • 6 long units (396 lines of code)
    • 61 medium size units (1,908 lines of code)
    • 86 small units (1,243 lines of code)
    • 323 very small units (1,574 lines of code)
10% | 6% | 33% | 21% | 27%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts11% | 6% | 34% | 21% | 26%
tsx0% | 11% | 25% | 23% | 39%
js0% | 0% | 0% | 0% | 100%
ino0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src41% | 0% | 22% | 12% | 22%
src/arduino10% | 2% | 41% | 19% | 25%
src/views0% | 17% | 22% | 20% | 39%
src/serialmonitor0% | 15% | 31% | 30% | 22%
src/debug0% | 22% | 48% | 21% | 6%
src/common0% | 0% | 31% | 41% | 26%
src/langService0% | 0% | 66% | 21% | 11%
src/logger0% | 0% | 21% | 28% | 50%
ROOT0% | 0% | 0% | 0% | 100%
snippets0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
335 57 1
private async _build()
in src/arduino/arduino.ts
238 65 2
public async startListening()
in src/serialmonitor/usbDetector.ts
90 29 0
export default function boardManagerReducer()
in src/views/app/reducers/boardManagerReducer.ts
69 10 2
export default function libraryManagerReducer()
in src/views/app/reducers/libraryManagerReducer.ts
66 13 2
public async resolveOpenOcdOptions()
in src/debug/debuggerManager.ts
61 24 1
export function makeCompilerParserContext()
in src/arduino/intellisense.ts
55 9 1
public render()
in src/views/app/components/LibraryManager.tsx
55 11 0
public async installBoard()
in src/arduino/arduino.ts
50 19 4
public async initialize()
in src/arduino/arduinoSettings.ts
50 16 0
public async loadExamples()
in src/arduino/exampleManager.ts
47 7 0
private async parseExamplesFromLibrary()
in src/arduino/exampleManager.ts
47 12 3
public async resolveMainSketch()
in src/deviceContext.ts
43 11 0
public loadPackageContent()
in src/arduino/boardManager.ts
42 11 1
export function decycle()
in src/common/cycle.ts
41 11 2
41 10 1
public initialize()
in src/serialmonitor/serialMonitor.ts
41 7 0
export function decycle()
in src/views/app/actions/cycle.ts
41 11 2
export default function boardConfigReducer()
in src/views/app/reducers/boardConfigReducer.ts
41 7 2
39 7 3