opensearch-project / OpenSearch
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 49,007 units with 491,715 lines of code in units (73.0% of code).
    • 280 very long units (40,504 lines of code)
    • 1,070 long units (71,838 lines of code)
    • 4,307 medium size units (133,974 lines of code)
    • 6,150 small units (89,756 lines of code)
    • 37,200 very small units (155,643 lines of code)
8% | 14% | 27% | 18% | 31%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
java8% | 14% | 27% | 18% | 31%
groovy14% | 12% | 32% | 19% | 20%
py0% | 0% | 0% | 71% | 28%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
server8% | 15% | 27% | 17% | 30%
modules13% | 16% | 24% | 15% | 30%
buildSrc5% | 9% | 27% | 23% | 33%
plugins2% | 10% | 32% | 22% | 31%
client1% | 1% | 14% | 32% | 49%
libs1% | 5% | 24% | 25% | 43%
distribution0% | 12% | 40% | 28% | 17%
doc-tools0% | 35% | 41% | 12% | 10%
benchmarks0% | 13% | 30% | 11% | 43%
qa0% | 0% | 41% | 17% | 41%
dev-tools0% | 0% | 0% | 71% | 28%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
protected Node()
in server/src/main/java/org/opensearch/node/Node.java
585 10 3
public void restoreSnapshot()
in server/src/main/java/org/opensearch/snapshots/RestoreService.java
451 60 2
public static PainlessCast getLegalCast()
in modules/lang-painless/src/main/java/org/opensearch/painless/AnalyzerCaster.java
380 298 5
public void testSortNestedWithNestedFilter()
in server/src/internalClusterTest/java/org/opensearch/search/nested/SimpleNestedIT.java
359 1 0
public void testAliasSearchRouting()
in server/src/internalClusterTest/java/org/opensearch/routing/AliasRoutingIT.java
329 13 0
public void visitBinaryMath()
in modules/lang-painless/src/main/java/org/opensearch/painless/phase/DefaultConstantFoldingOptimizationPhase.java
326 49 2
public void visitDot()
in modules/lang-painless/src/main/java/org/opensearch/painless/phase/DefaultSemanticAnalysisPhase.java
307 91 2
private ValuesSourceRegistry registerAggregations()
in server/src/main/java/org/opensearch/search/SearchModule.java
301 2 1
public final RstatementContext rstatement()
in modules/lang-painless/src/main/java/org/opensearch/painless/antlr/PainlessParser.java
278 90 0
protected Table getTableWithHeader()
in server/src/main/java/org/opensearch/rest/action/cat/RestIndicesAction.java
259 1 1
public void testCrossFieldMode()
in server/src/internalClusterTest/java/org/opensearch/search/query/MultiMatchQueryIT.java
257 3 0
public static Whitelist loadFromResourceFiles()
in modules/lang-painless/spi/src/main/java/org/opensearch/painless/spi/WhitelistLoader.java
249 39 3
public void testSortMVField()
in server/src/internalClusterTest/java/org/opensearch/search/sort/FieldSortIT.java
245 1 0
public void testDocValueFields()
in server/src/internalClusterTest/java/org/opensearch/search/fields/SearchFieldsIT.java
244 1 0
public void parse()
in server/src/main/java/org/opensearch/action/bulk/BulkRequestParser.java
237 42 12
public void addPainlessClassBinding()
in modules/lang-painless/src/main/java/org/opensearch/painless/lookup/PainlessLookupBuilder.java
236 28 6
public void testPercolatorQueryWithHighlighting()
in modules/percolator/src/internalClusterTest/java/org/opensearch/percolator/PercolatorQuerySearchIT.java
235 3 0
public void addPainlessMethod()
in modules/lang-painless/src/main/java/org/opensearch/painless/lookup/PainlessLookupBuilder.java
233 24 7
public void testMinMaxChildren()
in modules/parent-join/src/internalClusterTest/java/org/opensearch/join/query/ChildQuerySearchIT.java
232 1 0
public void testNestedSortWithMultiLevelFiltering()
in server/src/internalClusterTest/java/org/opensearch/search/nested/SimpleNestedIT.java
227 1 0