File AnnotationEditor.java
has 1007 lines of code (exceeds 250 allowed). Consider refactoring. Open
package gate.creole.ontology.ocat;
import gate.Annotation;
import gate.Factory;
import gate.FeatureMap;
Method actionPerformed
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
public void actionPerformed(ActionEvent ie) {
// if(ie.getStateChange() != 1) return;
if(explicitCall) return;
if(newAnnotationMode) {
Object selectedItem = typeCombo.getSelectedItem();
- 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 showWindow
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
private void showWindow() {
// and lets show it
final JTextArea textComp = ontologyTreePanel.ontoViewer.documentTextArea;
int x1 = textComp.getSelectionStart();
- 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 initGUI
has 150 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void initGUI() {
annotationWindow =
new JWindow(
SwingUtilities
.getWindowAncestor(ontologyTreePanel.ontoViewer.documentTextualDocumentView
Method actionPerformed
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
public void actionPerformed(ActionEvent ae) {
int[] range = ontologyTreePanel.ontoTreeListener.annotationRange;
int index1 = -1;
ArrayList<Integer> indexes = new ArrayList<Integer>();
- 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 actionPerformed
has 119 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void actionPerformed(ActionEvent ie) {
// if(ie.getStateChange() != 1) return;
if(explicitCall) return;
if(newAnnotationMode) {
Object selectedItem = typeCombo.getSelectedItem();
Method showWindow
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void showWindow() {
// and lets show it
final JTextArea textComp = ontologyTreePanel.ontoViewer.documentTextArea;
int x1 = textComp.getSelectionStart();
Method actionPerformed
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public void actionPerformed(ActionEvent e) {
try {
if(ontologyTreePanel.ontologyViewerOptions.getDeleteConfirmation()) {
Object[] options = new Object[]{"YES", "NO"};
int confirm =
- 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 actionPerformed
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void actionPerformed(ActionEvent ae) {
int[] range = ontologyTreePanel.ontoTreeListener.annotationRange;
int index1 = -1;
ArrayList<Integer> indexes = new ArrayList<Integer>();
Method actionPerformed
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void actionPerformed(ActionEvent e) {
try {
if(ontologyTreePanel.ontologyViewerOptions.getDeleteConfirmation()) {
Object[] options = new Object[]{"YES", "NO"};
int confirm =
Method getSimilarAnnotations
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private ArrayList<Annotation> getSimilarAnnotations(gate.Annotation annot) {
ArrayList<Annotation> annotations = new ArrayList<Annotation>();
String classValue =
Utils
.getClassFeatureValue(annot, ontologyTreePanel.ontologyViewerOptions);
- 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 getClassesAndInstances
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private ArrayList<ClassNode> getClassesAndInstances(IFolder rootNode,
String startWith) {
ArrayList<ClassNode> toReturn = new ArrayList<ClassNode>();
- 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 actionPerformed
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void actionPerformed(ActionEvent e) {
try {
gate.Annotation annot =
ontologyTreePanel.ontoTreeListener.highlightedAnnotations
.get(selectedAnnotationIndex);
Method actionPerformed
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void actionPerformed(ActionEvent e) {
try {
gate.Annotation annot =
ontologyTreePanel.ontoTreeListener.highlightedAnnotations
.get(selectedAnnotationIndex);
Method getSimilarAnnotations
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private ArrayList<Annotation> getSimilarAnnotations(gate.Annotation annot) {
ArrayList<Annotation> annotations = new ArrayList<Annotation>();
String classValue =
Utils
.getClassFeatureValue(annot, ontologyTreePanel.ontologyViewerOptions);
Method actionPerformed
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void actionPerformed(ActionEvent e) {
try {
if(!deHighlight.isSelected()) { return; }
Method actionPerformed
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void actionPerformed(ActionEvent e) {
gate.Annotation annot =
ontologyTreePanel.ontoTreeListener.highlightedAnnotations
.get(selectedAnnotationIndex);
int startOffset = annot.getStartNode().getOffset().intValue();
Method actionPerformed
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void actionPerformed(ActionEvent e) {
gate.Annotation annot =
ontologyTreePanel.ontoTreeListener.highlightedAnnotations
.get(selectedAnnotationIndex);
Method isValidDomain
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private boolean isValidDomain(RDFProperty aProp, OInstance inst) {
Set<OResource> domain = aProp.getDomain();
if(domain == null || domain.isEmpty()) return true;
ClassNode inode = ontologyTreePanel.getFirstNode(inst.getName());
for(OResource res : domain) {
- 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 isValidRange
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private boolean isValidRange(RDFProperty aProp, OInstance inst) {
Set<OResource> range = aProp.getRange();
if(range == null || range.isEmpty()) return true;
ClassNode inode = ontologyTreePanel.getFirstNode(inst.getName());
for(OResource res : range) {
- 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
Avoid deeply nested control flow statements. Open
for(int i = 0; i < annotations.size(); i++) {
ontologyTreePanel.deleteAnnotation(annotations.get(i));
}
Method getInstances
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private Set<OInstance> getInstances(IFolder rootNode) {
Set<OInstance> toReturn = new HashSet<OInstance>();
if(rootNode instanceof ClassNode
&& ((ClassNode)rootNode).getSource() instanceof OInstance) {
if(ontologyTreePanel.ontologyViewerOptions
- 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
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return;
Method hasChild
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private boolean hasChild(ClassNode parent, ClassNode child) {
if(parent == child) return true;
if(parent.getChildCount() == 0) return false;
Iterator iter = parent.getChildren();
while(iter.hasNext()) {
- 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 actionPerformed
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public void actionPerformed(ActionEvent e) {
try {
if(!deHighlight.isSelected()) { return; }
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
try {
gate.Annotation annot =
ontologyTreePanel.ontoTreeListener.highlightedAnnotations
.get(selectedAnnotationIndex);
int startOffset = annot.getStartNode().getOffset().intValue();
- 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 219.
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
public void actionPerformed(ActionEvent e) {
gate.Annotation annot =
ontologyTreePanel.ontoTreeListener.highlightedAnnotations
.get(selectedAnnotationIndex);
- 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 219.
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
private boolean isValidDomain(RDFProperty aProp, OInstance inst) {
Set<OResource> domain = aProp.getDomain();
if(domain == null || domain.isEmpty()) return true;
ClassNode inode = ontologyTreePanel.getFirstNode(inst.getName());
for(OResource res : domain) {
- 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 111.
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
private boolean isValidRange(RDFProperty aProp, OInstance inst) {
Set<OResource> range = aProp.getRange();
if(range == null || range.isEmpty()) return true;
ClassNode inode = ontologyTreePanel.getFirstNode(inst.getName());
for(OResource res : range) {
- 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 111.
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(annot != null) {
if(applyToAll.isSelected()) {
ArrayList<Annotation> annotations =
getSimilarAnnotations(annot);
for(int i = 0; i < annotations.size(); i++) {
- 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(annot != null) {
if(applyToAll.isSelected()) {
ArrayList<Annotation> annotations = getSimilarAnnotations(annot);
for(int i = 0; i < annotations.size(); i++) {
ontologyTreePanel.deleteAnnotation(annotations.get(i));
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if(isNewAnnotationMode) {
deleteBtn.setEnabled(false);
soelBtn.setEnabled(false);
soerBtn.setEnabled(false);
eoelBtn.setEnabled(false);
- 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 58.
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
else {
deleteBtn.setEnabled(true);
soelBtn.setEnabled(true);
soerBtn.setEnabled(true);
eoelBtn.setEnabled(true);
- 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 58.
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