opensearch-project / opensearch-js
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 183 units with 2,960 lines of code in units (44.7% of code).
    • 1 very long units (151 lines of code)
    • 7 long units (446 lines of code)
    • 38 medium size units (1,177 lines of code)
    • 42 small units (661 lines of code)
    • 95 very small units (525 lines of code)
5% | 15% | 39% | 22% | 17%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js5% | 15% | 39% | 22% | 17%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
scripts/utils14% | 43% | 15% | 12% | 13%
api/api0% | 0% | 70% | 25% | 3%
lib0% | 0% | 35% | 23% | 41%
scripts0% | 0% | 41% | 35% | 22%
api0% | 0% | 0% | 59% | 40%
ROOT0% | 0% | 0% | 42% | 57%
lib/pool0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
function genFactory()
in scripts/utils/generateMain.js
151 20 3
function generateSingleApi()
in scripts/utils/generateApis.js
75 19 3
function buildPath()
in scripts/utils/generateApis.js
70 21 0
function generateDocs()
in scripts/utils/generateDocs.js
66 45 2
function generateNamespace()
in scripts/utils/generateApis.js
63 7 4
function generateApiDoc()
in scripts/utils/generateDocs.js
62 13 1
function generateRequestType()
in scripts/utils/generateRequestTypes.js
59 15 1
function buildMethodDefinition()
in scripts/utils/generateMain.js
51 11 6
function onArtifactsDownloaded()
in scripts/generate.js
46 3 0
function tryBulk()
in lib/Helpers.js
45 13 2
async function resolve()
in scripts/download-artifacts.js
45 8 2
function getType()
in scripts/utils/generateRequestTypes.js
44 18 2
function generate()
in scripts/utils/generateRequestTypes.js
43 4 2
async function downloadArtifacts()
in scripts/download-artifacts.js
38 10 1
for await()
in lib/Helpers.js
35 11 1
function existsSourceApi()
in api/api/exists_source.js
35 13 3
function indexApi()
in api/api/index.js
34 15 3
url: stripAuth()
in lib/Connection.js
32 5 1
function deleteByQueryApi()
in api/api/delete_by_query.js
32 10 3
function putScriptApi()
in api/api/put_script.js
32 10 3