SiLeBAT/FSK-Lab

View on GitHub
de.bund.bfr.knime.foodprocess/src/de/bund/bfr/knime/foodprocess/ui/CreateWorkflow.java

Summary

Maintainability
F
1 wk
Test Coverage

Method addNodes has a Cognitive Complexity of 210 (exceeds 5 allowed). Consider refactoring.
Open

    private void addNodes(final Connection conn, final WorkflowManager wfm) throws CoreException {    
        LinkedHashMap<Integer, NodeID> nodesMap = new LinkedHashMap<Integer, NodeID>();
        LinkedHashMap<Integer, Integer> fromMap = new LinkedHashMap<Integer, Integer>();
        LinkedHashMap<Integer, Integer> toMap = new LinkedHashMap<Integer, Integer>();
        //LinkedHashMap<Integer, LinkedHashMap<Integer, Double>> fractionsIn = new LinkedHashMap<Integer, LinkedHashMap<Integer, Double>>(); 

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 addNodes has 188 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private void addNodes(final Connection conn, final WorkflowManager wfm) throws CoreException {    
        LinkedHashMap<Integer, NodeID> nodesMap = new LinkedHashMap<Integer, NodeID>();
        LinkedHashMap<Integer, Integer> fromMap = new LinkedHashMap<Integer, Integer>();
        LinkedHashMap<Integer, Integer> toMap = new LinkedHashMap<Integer, Integer>();
        //LinkedHashMap<Integer, LinkedHashMap<Integer, Double>> fractionsIn = new LinkedHashMap<Integer, LinkedHashMap<Integer, Double>>(); 

File CreateWorkflow.java has 424 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*******************************************************************************
 * Copyright (c) 2015 Federal Institute for Risk Assessment (BfR), Germany
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by

Method doLhm has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    private void doLhm(SingleNodeContainer p2Container, LinkedHashMap<Integer, Double> lhm, LinkedHashMap<Integer, Matrix> lhmm, int fromPort, int toKey) throws SQLException {
        if (lhm != null) {
            //FoodProcessNodeModel p2Model = ((FoodProcessNodeModel)p2Container.getNode().getNodeModel());
            FoodProcessNodeModel p2Model = ((FoodProcessNodeModel)((NativeNodeContainer)p2Container).getNode().getNodeModel());
            FoodProcessNodeSettings fns = p2Model.getSetting();

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 loadWorkflowManager2 has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private void loadWorkflowManager2(final Connection conn, final int pcId)
            throws Exception {

        String projectName = "PC_" + System.currentTimeMillis();
        Object pn = DBKernel.getValue("ProzessWorkflow", "ID", pcId+"", "Name");

Method createProject has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private IProject createProject(final IPath workflowPath) throws CoreException {
        IProgressMonitor monitor = new NullProgressMonitor();
        
         IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
            IResource resource = root.findMember(workflowPath);

Method doLhm has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private void doLhm(SingleNodeContainer p2Container, LinkedHashMap<Integer, Double> lhm, LinkedHashMap<Integer, Matrix> lhmm, int fromPort, int toKey) throws SQLException {
        if (lhm != null) {
            //FoodProcessNodeModel p2Model = ((FoodProcessNodeModel)p2Container.getNode().getNodeModel());
            FoodProcessNodeModel p2Model = ((FoodProcessNodeModel)((NativeNodeContainer)p2Container).getNode().getNodeModel());
            FoodProcessNodeSettings fns = p2Model.getSetting();

Method createNodeContainer has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    private SingleNodeContainer createNodeContainer(WorkflowManager wfm, Integer processID, Object nodeAnno, String description, LinkedHashMap<Integer, NodeID> nodesMap, NodeFactory pf) {

Avoid deeply nested control flow statements.
Open

                        if (rsZ != null && rsZ.first()) {                                    
                            ops[fromPort - 1].setOutFlux(100 * lhm.get(vp) / sum);
                            lhm.put(vp, -lhm.get(vp));
                            //addedVP = vp;
                            if (lhmm != null && lhmm.containsKey(vp)) ops[fromPort - 1].setMatrix(lhmm.get(vp));

Avoid deeply nested control flow statements.
Open

                                        if (vp == null) {
                                            // new Node: IngredientNode
                                            if (dbl != null) {
                                                if (unit <= 7) { // ADV-Codes: 1=Kilogramm 2=Gramm 7=Liter 24=Prozent 25=Promille 35=Stück
                                                    if (unit == 1) dbl *= 1000;

Method doLhm has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    private void doLhm(SingleNodeContainer p2Container, LinkedHashMap<Integer, Double> lhm, LinkedHashMap<Integer, Matrix> lhmm, int fromPort, int toKey) throws SQLException {

Method createProject has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private IProject createProject(final IPath workflowPath) throws CoreException {
        IProgressMonitor monitor = new NullProgressMonitor();
        
         IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
            IResource resource = root.findMember(workflowPath);

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 getDouble has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private Double getDouble(final Object dbl) {
        Double result = null;
        if (dbl != null) {
            try {
                if (dbl instanceof Double) {

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

Refactor this method to reduce its Cognitive Complexity from 223 to the 15 allowed.
Open

    private void addNodes(final Connection conn, final WorkflowManager wfm) throws CoreException {    

Cognitive Complexity is a measure of how hard the control flow of a method is to understand. Methods with high Cognitive Complexity will be difficult to maintain.

See

Refactor this method to reduce its Cognitive Complexity from 30 to the 15 allowed.
Open

    private void doLhm(SingleNodeContainer p2Container, LinkedHashMap<Integer, Double> lhm, LinkedHashMap<Integer, Matrix> lhmm, int fromPort, int toKey) throws SQLException {

Cognitive Complexity is a measure of how hard the control flow of a method is to understand. Methods with high Cognitive Complexity will be difficult to maintain.

See

Define a constant instead of duplicating this literal " WHERE " 4 times.
Open

                " WHERE " + DBKernel.delimitL("Workflow") + "=" + processchainID, false);

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

public void run() {
  prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
  execute("action1");
  release("action1");
}

@SuppressWarning("all")                            // Compliant - annotations are excluded
private void method1() { /* ... */ }
@SuppressWarning("all")
private void method2() { /* ... */ }

public String method3(String a) {
  System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
  return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
}

Compliant Solution

private static final String ACTION_1 = "action1";  // Compliant

public void run() {
  prepare(ACTION_1);                               // Compliant
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "SELECT * FROM " 3 times.
Open

        ResultSet rs = DBKernel.getResultSet("SELECT * FROM " + DBKernel.delimitL("Prozessdaten") +

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

public void run() {
  prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
  execute("action1");
  release("action1");
}

@SuppressWarning("all")                            // Compliant - annotations are excluded
private void method1() { /* ... */ }
@SuppressWarning("all")
private void method2() { /* ... */ }

public String method3(String a) {
  System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
  return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
}

Compliant Solution

private static final String ACTION_1 = "action1";  // Compliant

public void run() {
  prepare(ACTION_1);                               // Compliant
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "Funktion (Zeit)" 4 times.
Open

                        Object o = DBKernel.getValue("DoubleKennzahlen", "ID", rs.getInt("Temperatur")+"", "Funktion (Zeit)");

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

public void run() {
  prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
  execute("action1");
  release("action1");
}

@SuppressWarning("all")                            // Compliant - annotations are excluded
private void method1() { /* ... */ }
@SuppressWarning("all")
private void method2() { /* ... */ }

public String method3(String a) {
  System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
  return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
}

Compliant Solution

private static final String ACTION_1 = "action1";  // Compliant

public void run() {
  prepare(ACTION_1);                               // Compliant
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "DoubleKennzahlen" 11 times.
Open

                    Double dbl = getDouble(DBKernel.getValue("DoubleKennzahlen", "ID", rs.getInt("Kapazitaet")+"", "Wert"));

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

public void run() {
  prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
  execute("action1");
  release("action1");
}

@SuppressWarning("all")                            // Compliant - annotations are excluded
private void method1() { /* ... */ }
@SuppressWarning("all")
private void method2() { /* ... */ }

public String method3(String a) {
  System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
  return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
}

Compliant Solution

private static final String ACTION_1 = "action1";  // Compliant

public void run() {
  prepare(ACTION_1);                               // Compliant
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "Prozessdaten" 3 times.
Open

        ResultSet rs = DBKernel.getResultSet("SELECT * FROM " + DBKernel.delimitL("Prozessdaten") +

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

public void run() {
  prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
  execute("action1");
  release("action1");
}

@SuppressWarning("all")                            // Compliant - annotations are excluded
private void method1() { /* ... */ }
@SuppressWarning("all")
private void method2() { /* ... */ }

public String method3(String a) {
  System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
  return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
}

Compliant Solution

private static final String ACTION_1 = "action1";  // Compliant

public void run() {
  prepare(ACTION_1);                               // Compliant
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Make sure "sum" can't be zero before doing this division.
Open

                        ops[fromPort - 1].setOutFlux(100 * lhm.get(vp) / sum);

If the denominator to a division or modulo operation is zero it would result in a fatal error.

When working with double or float, no fatal error will be raised, but it will lead to unusual result and should be avoided anyway.

This rule supports primitive int, long, double, float as well as BigDecimal and BigInteger.

Noncompliant Code Example

void test_divide() {
  int z = 0;
  if (unknown()) {
    // ..
    z = 3;
  } else {
    // ..
  }
  z = 1 / z; // Noncompliant, possible division by zero
}

Compliant Solution

void test_divide() {
  int z = 0;
  if (unknown()) {
    // ..
    z = 3;
  } else {
    // ..
    z = 1;
  }
  z = 1 / z;
}

See

  • MITRE, CWE-369 - Divide by zero
  • CERT, NUM02-J. - Ensure that division and remainder operations do not result in divide-by-zero errors
  • CERT, INT33-C. - Ensure that division and remainder operations do not result in divide-by-zero errors

Make sure "sum" can't be zero before doing this division.
Open

                            ops[fromPort - 1].setOutFlux(100 * lhm.get(vp) / sum);

If the denominator to a division or modulo operation is zero it would result in a fatal error.

When working with double or float, no fatal error will be raised, but it will lead to unusual result and should be avoided anyway.

This rule supports primitive int, long, double, float as well as BigDecimal and BigInteger.

Noncompliant Code Example

void test_divide() {
  int z = 0;
  if (unknown()) {
    // ..
    z = 3;
  } else {
    // ..
  }
  z = 1 / z; // Noncompliant, possible division by zero
}

Compliant Solution

void test_divide() {
  int z = 0;
  if (unknown()) {
    // ..
    z = 3;
  } else {
    // ..
    z = 1;
  }
  z = 1 / z;
}

See

  • MITRE, CWE-369 - Divide by zero
  • CERT, NUM02-J. - Ensure that division and remainder operations do not result in divide-by-zero errors
  • CERT, INT33-C. - Ensure that division and remainder operations do not result in divide-by-zero errors

Similar blocks of code found in 4 locations. Consider refactoring.
Open

                    if (dbl != null) {
                        foodProcessSetting.getParametersSetting().setAw(dbl+"");
                    }
                    else {
                        Object o = DBKernel.getValue("DoubleKennzahlen", "ID", rs.getInt("aw")+"", "Funktion (Zeit)");
de.bund.bfr.knime.foodprocess/src/de/bund/bfr/knime/foodprocess/ui/CreateWorkflow.java on lines 227..233
de.bund.bfr.knime.foodprocess/src/de/bund/bfr/knime/foodprocess/ui/CreateWorkflow.java on lines 236..242
de.bund.bfr.knime.foodprocess/src/de/bund/bfr/knime/foodprocess/ui/CreateWorkflow.java on lines 252..258

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

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

                    if (dbl != null) {
                        foodProcessSetting.getParametersSetting().setPh(dbl+"");
                    }
                    else {
                        Object o = DBKernel.getValue("DoubleKennzahlen", "ID", rs.getInt("pH")+"", "Funktion (Zeit)");
de.bund.bfr.knime.foodprocess/src/de/bund/bfr/knime/foodprocess/ui/CreateWorkflow.java on lines 227..233
de.bund.bfr.knime.foodprocess/src/de/bund/bfr/knime/foodprocess/ui/CreateWorkflow.java on lines 244..250
de.bund.bfr.knime.foodprocess/src/de/bund/bfr/knime/foodprocess/ui/CreateWorkflow.java on lines 252..258

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

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

                    if (dbl != null) {
                        foodProcessSetting.getParametersSetting().setPressure(dbl+"");
                    }
                    else {
                        Object o = DBKernel.getValue("DoubleKennzahlen", "ID", rs.getInt("Druck")+"", "Funktion (Zeit)");
de.bund.bfr.knime.foodprocess/src/de/bund/bfr/knime/foodprocess/ui/CreateWorkflow.java on lines 227..233
de.bund.bfr.knime.foodprocess/src/de/bund/bfr/knime/foodprocess/ui/CreateWorkflow.java on lines 236..242
de.bund.bfr.knime.foodprocess/src/de/bund/bfr/knime/foodprocess/ui/CreateWorkflow.java on lines 244..250

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

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

                    if (dbl != null) {
                        foodProcessSetting.getParametersSetting().setTemperature(dbl+"");
                    }
                    else {
                        Object o = DBKernel.getValue("DoubleKennzahlen", "ID", rs.getInt("Temperatur")+"", "Funktion (Zeit)");
de.bund.bfr.knime.foodprocess/src/de/bund/bfr/knime/foodprocess/ui/CreateWorkflow.java on lines 236..242
de.bund.bfr.knime.foodprocess/src/de/bund/bfr/knime/foodprocess/ui/CreateWorkflow.java on lines 244..250
de.bund.bfr.knime.foodprocess/src/de/bund/bfr/knime/foodprocess/ui/CreateWorkflow.java on lines 252..258

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

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

                    if (element == null || element.toString().length() == 0) {
                        element = (nodeAnno == null ? "" : nodeAnno.toString());
                    }
de.bund.bfr.knime.foodprocess/src/de/bund/bfr/knime/foodprocess/ui/CreateWorkflow.java on lines 182..184

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

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

                    if (nodeAnno == null || nodeAnno.toString().length() == 0) {
                        nodeAnno = (element == null ? "" : element.toString());
                    }
de.bund.bfr.knime.foodprocess/src/de/bund/bfr/knime/foodprocess/ui/CreateWorkflow.java on lines 185..187

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

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

                        ResultSet rsZ = DBKernel.getResultSet("SELECT * FROM " + DBKernel.delimitL("Zutatendaten") +
                                " WHERE " + DBKernel.delimitL("Prozessdaten") + "=" + processID, false);
de.bund.bfr.knime.foodprocess/src/de/bund/bfr/knime/foodprocess/ui/CreateWorkflow.java on lines 172..173
org.hsh.bfr.db/src/org/hsh/bfr/db/exports/ExcelExport.java on lines 171..172
org.hsh.bfr.db/src/org/hsh/bfr/db/gui/dbtable/MyDBTable.java on lines 726..727

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 42.

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

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

        ResultSet rs = DBKernel.getResultSet("SELECT * FROM " + DBKernel.delimitL("Prozessdaten") +
                " WHERE " + DBKernel.delimitL("Workflow") + "=" + processchainID, false);
de.bund.bfr.knime.foodprocess/src/de/bund/bfr/knime/foodprocess/ui/CreateWorkflow.java on lines 281..282
org.hsh.bfr.db/src/org/hsh/bfr/db/exports/ExcelExport.java on lines 171..172
org.hsh.bfr.db/src/org/hsh/bfr/db/gui/dbtable/MyDBTable.java on lines 726..727

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 42.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                        duu = du.equals("Stunde") ? "h" : du.equals("Sekunde") ? "s" :
                            du.equals("Tag") ? "d" : du.equals("Minute") ? "min" : du.equals("Woche") ? "d" : "";
de.bund.bfr.knime.foodprocess/src/de/bund/bfr/knime/foodprocess/db/WriterNodeModel.java on lines 170..171

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 42.

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

Further Reading

There are no issues that match your filters.

Category
Status