Method doExec
has a Cognitive Complexity of 172 (exceeds 5 allowed). Consider refactoring. Open
public ExecutionResult doExec(DifferentialFunction op,
OpContext opContext,
FrameIter outputFrameIter,
Set<VarId> opInputs, Set<VarId> allIterInputs,
Set<String> constAndPhInputs,
- 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 getOutputsHelperTensorArrayOps
has a Cognitive Complexity of 158 (exceeds 5 allowed). Consider refactoring. Open
public ExecutionResult getOutputsHelperTensorArrayOps(DifferentialFunction op, FrameIter outputFrameIter, Set<VarId> opInputs, Set<VarId> allIterInputs, Map<String, SDValue> otherPlaceHolders) {
/*
TODO: TensorArray memory management note: For now, we'll close any INDArrays stored in the TensorArray at the end of
graph execution. This uses more memory than necessary for an earlier close strategy, but simplifies memory management.
This should be revisited and optimized later
- 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 getOutputs
has a Cognitive Complexity of 152 (exceeds 5 allowed). Consider refactoring. Open
@Override
public ExecutionResult getOutputs(Pair<SameDiffOp, OpContext> opPair,
FrameIter outputFrameIter,
Set<VarId> opInputs,
Set<VarId> allIterInputs,
- 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 InferenceSession.java
has 1172 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
Method getAndParameterizeOp
has a Cognitive Complexity of 105 (exceeds 5 allowed). Consider refactoring. Open
@Override
public Pair<SameDiffOp,OpContext> getAndParameterizeOp(String opName, FrameIter frameIter, Set<VarId> opInputs, Set<VarId> allIterInputs,
Set<String> constAndPhInputs, Map<String, INDArray> placeholderValues, Set<String> allReqVariables, Map<String, SDValue> otherPlaceholders) {
SameDiffOp sdo = sameDiff.getOps().get(opName);
DifferentialFunction df = sdo.getOp();
- 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 doExec
has 299 lines of code (exceeds 25 allowed). Consider refactoring. Open
public ExecutionResult doExec(DifferentialFunction op,
OpContext opContext,
FrameIter outputFrameIter,
Set<VarId> opInputs, Set<VarId> allIterInputs,
Set<String> constAndPhInputs,
Method getOutputsHelperTensorArrayOps
has 276 lines of code (exceeds 25 allowed). Consider refactoring. Open
public ExecutionResult getOutputsHelperTensorArrayOps(DifferentialFunction op, FrameIter outputFrameIter, Set<VarId> opInputs, Set<VarId> allIterInputs, Map<String, SDValue> otherPlaceHolders) {
/*
TODO: TensorArray memory management note: For now, we'll close any INDArrays stored in the TensorArray at the end of
graph execution. This uses more memory than necessary for an earlier close strategy, but simplifies memory management.
This should be revisited and optimized later
Method getAndParameterizeOp
has 159 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public Pair<SameDiffOp,OpContext> getAndParameterizeOp(String opName, FrameIter frameIter, Set<VarId> opInputs, Set<VarId> allIterInputs,
Set<String> constAndPhInputs, Map<String, INDArray> placeholderValues, Set<String> allReqVariables, Map<String, SDValue> otherPlaceholders) {
SameDiffOp sdo = sameDiff.getOps().get(opName);
DifferentialFunction df = sdo.getOp();
Method getOutputs
has 157 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public ExecutionResult getOutputs(Pair<SameDiffOp, OpContext> opPair,
FrameIter outputFrameIter,
Set<VarId> opInputs,
Set<VarId> allIterInputs,
Method preprocessPlaceholders
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
@Override
protected Map<String, INDArray> preprocessPlaceholders(Map<String, INDArray> placeholders, At at) {
arrayUseTracker.clear();
//We'll also use this method as a "pre execution" hook-in, to mark variables as something we should never deallocate
- 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 postProcessOutputValues
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
@Override
protected Map<String, SDValue> postProcessOutputValues(Map<String, SDValue> output) {
//For any queued (not yet processed) ops - mark them as satisfied, so we can deallocate any arrays
// that are waiting on them
if (dt.hasNewAllSatisfied()) {
- 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 preprocessPlaceholders
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
protected Map<String, INDArray> preprocessPlaceholders(Map<String, INDArray> placeholders, At at) {
arrayUseTracker.clear();
//We'll also use this method as a "pre execution" hook-in, to mark variables as something we should never deallocate
Consider simplifying this complex logical expression. Open
if (df instanceof LoopCond || df instanceof Enter || df instanceof Exit || df instanceof NextIteration ||
df instanceof Merge || df instanceof Switch || df instanceof BaseTensorOp || df instanceof Invoke) {
//Control dependencies and tensor ops (like TensorArray, TensorArrayRead etc) don't need inputs set, execution is a special case
return new Pair<>(sdo, null);
}
Method getOutputs
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
public ExecutionResult getOutputs(Pair<SameDiffOp, OpContext> opPair,
FrameIter outputFrameIter,
Set<VarId> opInputs,
Set<VarId> allIterInputs,
Set<String> constAndPhInputs,
Method postProcessOutputValues
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
protected Map<String, SDValue> postProcessOutputValues(Map<String, SDValue> output) {
//For any queued (not yet processed) ops - mark them as satisfied, so we can deallocate any arrays
// that are waiting on them
if (dt.hasNewAllSatisfied()) {
Method getAndParameterizeOp
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
public Pair<SameDiffOp,OpContext> getAndParameterizeOp(String opName, FrameIter frameIter, Set<VarId> opInputs, Set<VarId> allIterInputs,
Set<String> constAndPhInputs, Map<String, INDArray> placeholderValues, Set<String> allReqVariables, Map<String, SDValue> otherPlaceholders) {
Method doExec
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public ExecutionResult doExec(DifferentialFunction op,
OpContext opContext,
FrameIter outputFrameIter,
Set<VarId> opInputs, Set<VarId> allIterInputs,
Set<String> constAndPhInputs,
Avoid deeply nested control flow statements. Open
if(getValue.getListValue().get(j) != null) {
args[i] = getValue.getListValue().get(j);
break;
}
Avoid deeply nested control flow statements. Open
if (e.isConstant()) {
/*
Constant enter case: Need to keep this array around for the entire duration of the frame, including
any nested frames, and all iterations.
Unfortunately, we don't know exactly when we're done with a frame for good
Avoid deeply nested control flow statements. Open
if(arr != null && !freedArrays.contains(arr.getId()) && sameDiff.isEnableCache()) {
mmgr.release(arr);
freedArrays.add(arr.getId());
}
Avoid deeply nested control flow statements. Open
if(!freedArrays.contains(value.getTensorValue().getId()) &&
sameDiff.isEnableCache() && !containsOutput) {
mmgr.release(value.getTensorValue());
freedArrays.add(value.getTensorValue().getId());
}
Avoid deeply nested control flow statements. Open
for(INDArray arr : value.getListValue())
if(arr != null && !freedArrays.contains(arr.getId()) && sameDiff.isEnableCache() && !containsOutput) {
mmgr.release(arr);
freedArrays.add(arr.getId());
}
Avoid deeply nested control flow statements. Open
for (int i = 0; i < out.numResults(); i++)
namedOutsBuilder.put(op.outputsOfOp.get(i), out.resultAt(i));
Method getOutputsHelperTensorArrayOps
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public ExecutionResult getOutputsHelperTensorArrayOps(DifferentialFunction op, FrameIter outputFrameIter, Set<VarId> opInputs, Set<VarId> allIterInputs, Map<String, SDValue> otherPlaceHolders) {
Avoid too many return
statements within this method. Open
return ExecutionResult.createFrom(Arrays.asList(vid.getVariable()),new INDArray[]{inArr});
Avoid too many return
statements within this method. Open
return ExecutionResult.createFrom(v.getVariable(),out);
Avoid too many return
statements within this method. Open
return ExecutionResult.createValue(op.outputVariablesNames()[0], sdValue);
Avoid too many return
statements within this method. Open
return ExecutionResult.createFrom(tensorArray.getVar().name(),scalar);
Avoid too many return
statements within this method. Open
return ExecutionResult.createValue(vid.getVariable(),nodeValueOutputs.get(vid));
Avoid too many return
statements within this method. Open
return ExecutionResult.createValue(op.outputVariablesNames()[0], sdValue);
Avoid too many return
statements within this method. Open
return ExecutionResult.createFrom(Arrays.asList(in.getVariable()),new INDArray[]{inArr});
Avoid too many return
statements within this method. Open
return ExecutionResult.createFrom(tArr.getVariable(),out);
Avoid too many return
statements within this method. Open
return ExecutionResult.createFrom(Arrays.asList("gradientbackwardsmarker"), new INDArray[]{out});
Avoid too many return
statements within this method. Open
return ExecutionResult.createValue(in.getVariable(),value);
Avoid too many return
statements within this method. Open
return ExecutionResult.createValue(vid.getVariable(),orig);
Avoid too many return
statements within this method. Open
return ExecutionResult.createFrom(Arrays.asList(n), new INDArray[]{out});
Avoid too many return
statements within this method. Open
return ExecutionResult.createFrom(c,opContext);
Avoid too many return
statements within this method. Open
return ExecutionResult.createValue(vid.getVariable(), getValue);
Avoid too many return
statements within this method. Open
return ExecutionResult.createFrom(op.outputVariablesNames()[0], from);
Avoid too many return
statements within this method. Open
return ExecutionResult.createValue(inputVarId.getVariable(),
value);
Avoid too many return
statements within this method. Open
return getOutputsHelperTensorArrayOps(op, outputFrameIter, opInputs, allIterInputs, otherPlaceHolders);
Avoid too many return
statements within this method. Open
return ExecutionResult.createValue(inputVarId.getVariable(), sdValue);
Avoid too many return
statements within this method. Open
return ExecutionResult.createFrom(Arrays.asList(inputVarId.getVariable()),new INDArray[]{inArr});
Avoid too many return
statements within this method. Open
return ExecutionResult.createValue(op.outputVariable().name(),sdValue1);
Avoid too many return
statements within this method. Open
return ExecutionResult.createFrom(Arrays.asList(in.getVariable()),new INDArray[]{inArr});
Avoid too many return
statements within this method. Open
return ExecutionResult.createFrom(Arrays.asList(inputVarId.getVariable()),new INDArray[]{inArr});
Avoid too many return
statements within this method. Open
return executionResultBuilder.build();
Avoid too many return
statements within this method. Open
return ExecutionResult.createFrom(tArr.getVariable(),out);
Avoid too many return
statements within this method. Open
return ExecutionResult.createValue(vid.getVariable(), getSdValue(vid));
Avoid too many return
statements within this method. Open
return ExecutionResult.createValue(vid.getVariable(),listValue);
Identical blocks of code found in 2 locations. Consider refactoring. Open
if(nodeValueOutputs.containsKey(in) && getSdValue(in) != null) {
SDValue value = getSdValue(in);
if(value != null && value.getSdValueType() == SDValueType.LIST) {
return ExecutionResult.createValue(in.getVariable(),value);
} else if(value != null && value.getSdValueType() == SDValueType.TENSOR) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 168.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
if(nodeValueOutputs.containsKey(inputVarId)) {
SDValue value = getSdValue(inputVarId);
if(value != null && value.getSdValueType() == SDValueType.LIST) {
return ExecutionResult.createValue(inputVarId.getVariable(),
value);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 168.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (constPhInput) {
//Constant or placeholder
inputVarId = new VarId(constAndPhInputs.iterator().next(), OUTER_FRAME, 0, null);
} else if (allIterInputs != null && allIterInputs.size() > 0) {
inputVarId = allIterInputs.iterator().next();
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 72.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (constPhInput) {
//Constant or placeholder
inputVarId = new VarId(constAndPhInputs.iterator().next(), OUTER_FRAME, 0, null);
} else if (allIterInputs != null && allIterInputs.size() > 0) {
inputVarId = allIterInputs.iterator().next();
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 72.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
while (sameDiff.getVariableOutputOp(inTensorArray.name()) instanceof Enter) {
//Handle the Enter case: this is like TensorArray -> Enter -> TensorArrayWrite
//TODO also TensorArrayScatter, etc??
inTensorArray = sameDiff.getVariableOutputOp(inTensorArray.name()).arg();
tArr = tArr.getParentFrame().toVarId(inTensorArray.name());
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 46.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
while (sameDiff.getVariableOutputOp(inTensorArray.name()) instanceof Enter) {
//Handle the Enter case: this is like TensorArray -> Enter -> TensorArrayWrite
//TODO also TensorArrayScatter, etc??
inTensorArray = sameDiff.getVariableOutputOp(inTensorArray.name()).arg();
tArr = tArr.getParentFrame().toVarId(inTensorArray.name());
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 46.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
log.trace("Scattering item at index " + i + " for list " + tArr + " with value " + get + " from whole list of " + l + " from values array " + valuesArr.toStringFull() + " named " + valuesSDV.name());
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 44.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76