Showing 13,976 of 13,976 total issues
Method SDBaseOps
has a Cognitive Complexity of 2008 (exceeds 20 allowed). Consider refactoring. Open
fun SDBaseOps() = Namespace("BaseOps"){
val keepDimsDoc = Mixin("keepDims"){
Doc(Language.ANY, DocScope.ALL){
"""
- 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 Math
has a Cognitive Complexity of 1120 (exceeds 20 allowed). Consider refactoring. Open
fun Math() = Namespace("Math") {
Op("abs", transformSame) {
javaOpClass = "Abs"
Doc(Language.ANY, DocScope.ALL){
"""
- 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 TensorNamespace.java
has 6609 lines of code (exceeds 250 allowed). Consider refactoring. Open
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: tensor.proto
package org.nd4j.ir;
File MapperNamespace.java
has 6107 lines of code (exceeds 250 allowed). Consider refactoring. Open
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: mapper.proto
package org.nd4j.ir;
Method SDCNN
has a Cognitive Complexity of 664 (exceeds 20 allowed). Consider refactoring. Open
fun SDCNN() = Namespace("CNN"){
val namespaceJavaPackage = "org.nd4j.linalg.api.ops.impl.layers.convolution"
val dataFormat = Mixin("dataFormat"){
Arg(ENUM, "dataFormat") { possibleValues = listOf("NCHW", "NHWC"); description = "Data format: \"NCHW\" or \"NHWC\"" }
- 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 BaseNDArray.java
has 4162 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
File SameDiff.java
has 4043 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
Nd4j
has 507 methods (exceeds 20 allowed). Consider refactoring. Open
@Slf4j
public class Nd4j {
/**
* Bitwise namespace - operations related to bitwise manipulation of arrays
Method NN
has a Cognitive Complexity of 486 (exceeds 20 allowed). Consider refactoring. Open
fun NN() = Namespace("NN") {
val convPkg = "org.nd4j.linalg.api.ops.impl.layers.convolution"
Op("batchNorm") {
javaPackage = convPkg
- 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 doExtractArgDescriptors
has 1853 lines of code (exceeds 25 allowed). Consider refactoring. Open
@SneakyThrows
public Map<String, List<ArgDescriptorProposal>> doExtractArgDescriptors() {
Map<String, List<ArgDescriptorProposal>> ret = new HashMap<>();
List<OpDeclarationDescriptor> opDeclarationDescriptors = new ArrayList<>();
Map<String,OpDeclarationDescriptor> descriptorMap = new HashMap<>();
File Nd4j.java
has 3147 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
File OpNamespace.java
has 3049 lines of code (exceeds 250 allowed). Consider refactoring. Open
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: op.proto
package org.nd4j.ir;
File ArrayUtil.java
has 3038 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
File ComputationGraph.java
has 3001 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
BaseNDArray
has 391 methods (exceeds 20 allowed). Consider refactoring. Open
@Slf4j
public abstract class BaseNDArray implements INDArray, Iterable {
private static final long serialVersionUID = 3285982317165542614L;
SDMath
has 370 methods (exceeds 20 allowed). Consider refactoring. Open
public class SDMath extends SDOps {
public SDMath(SameDiff sameDiff) {
super(sameDiff);
}
Method importGraph
has a Cognitive Complexity of 359 (exceeds 20 allowed). Consider refactoring. Open
/**
* Import a Graph based on a {@link IRGraph} model from a GraphDef, with optional import overrides
*
* @param irGraph IRGraph reflecting the needed model import
* @param importOverride Optional import override for specific ops, keyed by op name
- 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
INDArray
has 347 methods (exceeds 20 allowed). Consider refactoring. Open
public interface INDArray extends Serializable, AutoCloseable {
/**
* Returns the shape information debugging information
* @return the shape information.
*/
ArrayUtil
has 347 methods (exceeds 20 allowed). Consider refactoring. Open
public class ArrayUtil {
private ArrayUtil() {}
File MultiLayerNetwork.java
has 2498 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
File Shape.java
has 2479 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
SDBaseOps
has 332 methods (exceeds 20 allowed). Consider refactoring. Open
public class SDBaseOps {
protected SameDiff sd;
public SDBaseOps(SameDiff sameDiff) {
this.sd = sameDiff;
File WordVectorSerializer.java
has 2252 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
NativeOps
has 299 methods (exceeds 20 allowed). Consider refactoring. Open
public interface NativeOps {
int contextNumInputs(Pointer execTrace);
int contextNumOutputs(Pointer execTrace);
int numInputs(Pointer execTrace);
File Libnd4jArgDescriptorSource.java
has 2072 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
Similar blocks of code found in 2 locations. Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
- 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 2708.
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
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
- 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 2708.
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
File UpdateDecoder.java
has 2025 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
SameDiff
has 275 methods (exceeds 20 allowed). Consider refactoring. Open
@Slf4j
public class SameDiff extends SDBaseOps {
protected static final String GRAD_FN_KEY = "grad";
//Fields for graph structure and execution
File SDMath.java
has 1992 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
Method SDImage
has a Cognitive Complexity of 278 (exceeds 20 allowed). Consider refactoring. Open
fun SDImage() = Namespace("Image"){
val namespaceJavaPackage = "org.nd4j.linalg.api.ops.custom"
Op("CropAndResize") {
javaPackage = "org.nd4j.linalg.api.ops.impl.image"
javaOpClass = "CropAndResize"
- 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 SDBaseOps.kt
has 1949 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
File BaseDataBuffer.java
has 1929 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
Method SDLoss
has a Cognitive Complexity of 267 (exceeds 20 allowed). Consider refactoring. Open
fun SDLoss() = Namespace("Loss"){
Op("absoluteDifference") {
javaPackage = "org.nd4j.linalg.api.ops.impl.loss"
javaOpClass = "AbsoluteDifferenceLoss"
- 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 SDBaseOps.java
has 1790 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
Method output
has a Cognitive Complexity of 227 (exceeds 5 allowed). Consider refactoring. Open
public ExecutionResult output(@NonNull List<String> variables,
Map<String, T> placeholderValues,
Map<String, SDValue> otherPlaceHolderValues,
MultiDataSet batch,
Collection<String> requiredActivations,
- 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 SDRNN
has a Cognitive Complexity of 240 (exceeds 20 allowed). Consider refactoring. Open
fun SDRNN() = Namespace("RNN") {
val LSTMConfiguration = Config("LSTMConfiguration") {
- 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 StaticInfoDecoder.java
has 1703 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
Shape
has 229 methods (exceeds 20 allowed). Consider refactoring. Open
public class Shape {
private Shape() {}
Method importGraph
has a Cognitive Complexity of 224 (exceeds 5 allowed). Consider refactoring. Open
public static SameDiff importGraph(@NonNull GraphDef tfGraph, Map<String, TFImportOverride> importOverride, TFOpImportFilter opFilter) {
/*
First, build an in-memory representation of the graph that allows us to build the graph incrementally
If we can build the graph incrementally, we can make sure that the added variables are set up with the correct
- 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 CudaExecutioner.java
has 1612 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
Method Linalg
has a Cognitive Complexity of 226 (exceeds 20 allowed). Consider refactoring. Open
fun Linalg() = Namespace("Linalg") {
//val namespaceJavaPackage = "org.nd4j.linalg"
Op("Cholesky") {
javaPackage = "org.nd4j.linalg.api.ops.impl.transforms"
- 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
Builder
has 214 methods (exceeds 20 allowed). Consider refactoring. Open
public static final class Builder extends
org.nd4j.shade.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:org.nd4j.ir.MappingRule)
org.nd4j.ir.MapperNamespace.MappingRuleOrBuilder {
public static final org.nd4j.shade.protobuf.Descriptors.Descriptor
Method initAttributes
has a Cognitive Complexity of 220 (exceeds 20 allowed). Consider refactoring. Open
override fun <GRAPH_TYPE : GeneratedMessageV3, NODE_TYPE : GeneratedMessageV3, OP_DEF_TYPE : GeneratedMessageV3, TENSOR_TYPE : GeneratedMessageV3, ATTR_DEF_TYPE : GeneratedMessageV3, ATTR_VALUE_TYPE : GeneratedMessageV3, DATA_TYPE : ProtocolMessageEnum> initAttributes(
df: DifferentialFunction,
sd: SameDiff,
descriptorAndContext: Pair<MappingContext<GRAPH_TYPE, NODE_TYPE, OP_DEF_TYPE, TENSOR_TYPE, ATTR_DEF_TYPE, ATTR_VALUE_TYPE, DATA_TYPE>, OpNamespace.OpDescriptor>
) {
- 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 BaseCudaDataBuffer.java
has 1552 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
NDArrayFactory
has 202 methods (exceeds 20 allowed). Consider refactoring. Open
public interface NDArrayFactory {
char FORTRAN = 'f';
char C = 'c';
Similar blocks of code found in 3 locations. Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
- 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 1947.
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 3 locations. Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
- 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 1947.
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 3 locations. Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
- 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 1947.
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 12 locations. Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
- 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 1945.
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