opensearch-project / k-NN
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 885 units with 6,419 lines of code in units (60.7% of code).
    • 0 very complex units (0 lines of code)
    • 0 complex units (0 lines of code)
    • 9 medium complex units (505 lines of code)
    • 30 simple units (899 lines of code)
    • 846 very simple units (5,015 lines of code)
0% | 0% | 7% | 14% | 78%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
java0% | 0% | 7% | 10% | 81%
cpp0% | 0% | 8% | 27% | 63%
py0% | 0% | 4% | 23% | 72%
h0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
src/main/java/org0% | 0% | 7% | 10% | 81%
jni/src0% | 0% | 8% | 27% | 63%
benchmarks/perf-tool/okpt/diff0% | 0% | 29% | 0% | 70%
benchmarks/perf-tool/okpt/io0% | 0% | 0% | 29% | 70%
benchmarks/perf-tool/okpt0% | 0% | 0% | 0% | 100%
jni/include0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
private TrainingModelRequest createTransportRequest()
in src/main/java/org/opensearch/knn/plugin/rest/RestTrainModelHandler.java
51 19 1
public static KNNMethodContext parse()
in src/main/java/org/opensearch/knn/index/KNNMethodContext.java
65 18 1
public ActionRequestValidationException validate()
in src/main/java/org/opensearch/knn/plugin/transport/TrainingModelRequest.java
39 15 0
public static ValidationException validateKnnField()
in src/main/java/org/opensearch/knn/index/IndexUtil.java
68 15 4
void knn_jni::nmslib_wrapper::CreateIndex()
in jni/src/nmslib_wrapper.cpp
77 15 6
protected void parseCreateField()
in src/main/java/org/opensearch/knn/index/KNNVectorFieldMapper.java
57 14 2
public static KNNQueryBuilder fromXContent()
in src/main/java/org/opensearch/knn/index/KNNQueryBuilder.java
47 12 1
def _validate_keys()
in benchmarks/perf-tool/okpt/diff/diff.py
18 12 1
public Scorer scorer()
in src/main/java/org/opensearch/knn/index/KNNWeight.java
83 11 1
private KNNStatsRequest getRequest()
in src/main/java/org/opensearch/knn/plugin/rest/RestKNNStatsHandler.java
33 10 1
public void initialize()
in src/main/java/org/opensearch/knn/index/KNNCircuitBreaker.java
43 10 3
public void read()
in src/main/java/org/opensearch/knn/training/VectorReader.java
31 10 7
public static MethodComponentContext parse()
in src/main/java/org/opensearch/knn/index/MethodComponentContext.java
42 9 1
void knn_jni::faiss_wrapper::CreateIndex()
in jni/src/faiss_wrapper.cpp
49 9 6
def parse()
in benchmarks/perf-tool/okpt/io/config/parsers/test.py
24 9 2
private void putInternal()
in src/main/java/org/opensearch/knn/indices/ModelDao.java
58 8 3
public boolean isTrainingRequired()
in src/main/java/org/opensearch/knn/index/MethodComponent.java
26 8 1
public void run()
in src/main/java/org/opensearch/knn/training/TrainingJob.java
65 8 0
43 8 7
void SetExtraParameters()
in jni/src/faiss_wrapper.cpp
22 8 4