Showing 27 of 42 total issues
Method adjustAlpha
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public MTableFailProbPair adjustAlpha() {
double aMin = 0;
double aMax = alpha;
double aMid = (aMin + aMax) / 2;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method fairTopK
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
public TopDocs fairTopK(List<ScoreDoc> npQueue, List<ScoreDoc> pQueue, int k, float p, float alpha) {
FairScorer scorer = new FairScorer(k);
int [] m = fairnessLookup.fairnessAsTable(k, p, alpha);
Method rescore
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
@Override
public TopDocs rescore(TopDocs topDocs, IndexSearcher searcher, RescoreContext rescoreContext) throws IOException {
FairRescoreContext context = (FairRescoreContext)rescoreContext;
FairSearchConfig config = context.getConfig();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method fairTopK
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public TopDocs fairTopK(List<ScoreDoc> npQueue, List<ScoreDoc> pQueue, int k, float p, float alpha) {
FairScorer scorer = new FairScorer(k);
int [] m = fairnessLookup.fairnessAsTable(k, p, alpha);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File FairRescoreBuilder.java
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
package com.purbon.search.fair.query;
import com.purbon.search.fair.ModelStore;
import com.purbon.search.fair.lib.FairTopK;
import com.purbon.search.fair.lib.FairTopKImpl;
FairSearchConfig
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
public class FairSearchConfig {
private static Logger logger = ESLoggerFactory.getLogger(FairSearchConfig.class);
Method rescore
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public TopDocs rescore(TopDocs topDocs, IndexSearcher searcher, RescoreContext rescoreContext) throws IOException {
FairRescoreContext context = (FairRescoreContext)rescoreContext;
FairSearchConfig config = context.getConfig();
Method resolveNullEntries
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public void resolveNullEntries() {
if (col1.size() == 0 && col2.size() == 0){
return;
}
col1.set(0, 0);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method adjustAlpha
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public MTableFailProbPair adjustAlpha() {
double aMin = 0;
double aMax = alpha;
double aMid = (aMin + aMax) / 2;
Method computeFailureProbability
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public double computeFailureProbability() {
if (mTable[mTable.length - 1] == 0) {
return 0;
}
DataFrame auxMTable = this.mTableGenerator.computeAuxTMTable();
Method computeFailureProbability
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public double computeFailureProbability() {
if (mTable[mTable.length - 1] == 0) {
return 0;
}
DataFrame auxMTable = this.mTableGenerator.computeAuxTMTable();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function createMtableAndExecuteQuery
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createMtableAndExecuteQuery(k ,p, alpha, query, req, res){
var xhr = new XMLHttpRequest();
var data = JSON.stringify({"from" : 0, "size" : k,"query": {"match": {"body": query}}});
xhr.addEventListener("readystatechange", function() {
if (this.readyState === 4) {
Method generateMtable
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private int[] generateMtable(int k, float p, float a, String id) {
//check if the index exists
boolean mTableStoreExists = client
.admin().indices().prepareExists(ModelStore.STORE_NAME)
.get().isExists();
Method getRestHandlers
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public List<RestHandler> getRestHandlers(Settings settings, RestController restController,
ClusterSettings clusterSettings, IndexScopedSettings indexScopedSettings,
SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver,
Supplier<DiscoveryNodes> nodesInCluster) {
Function createMtableAndExecuteQuery
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function createMtableAndExecuteQuery(k ,p, alpha, query, req, res){
Function executeFairQueryWithAdjustedParameters
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function executeFairQueryWithAdjustedParameters(k,p,alpha,q, req, res){
Method fairTopK
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public TopDocs fairTopK(List<ScoreDoc> npQueue, List<ScoreDoc> pQueue, int k, float p, float alpha) {
Method fairTopK
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
TopDocs fairTopK(List<ScoreDoc> npQueue, List<ScoreDoc> pQueue, int k, float p, float alpha);
Method adjustIterative
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private double adjustIterative() {
double adjustedAlpha;
double left = Double.MIN_VALUE;
double right = alpha;
double minOptAlpha = (left + right) / 2.0;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method getSumOf
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public Integer getSumOf(String columnName) {
Integer sum = 0;
if (column1Name.equals(columnName)) {
for (Integer i : col1) {
sum += i;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"