SiLeBAT/FSK-Lab

View on GitHub
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java

Summary

Maintainability
F
2 wks
Test Coverage

File SwaggerUtil.java has 820 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package metadata;

import de.bund.bfr.metadata.swagger.ConsumptionModel;
import de.bund.bfr.metadata.swagger.DataModel;
import de.bund.bfr.metadata.swagger.DoseResponseModel;
Severity: Major
Found in de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java - About 1 day to fix

SwaggerUtil has 31 methods (exceeds 20 allowed). Consider refactoring.
Open

public class SwaggerUtil {

    @Deprecated
    public static de.bund.bfr.metadata.swagger.GenericModelGeneralInformation convert(
            metadata.GeneralInformation deprecatedGeneralInformation) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java - About 3 hrs to fix

Method getGeneralInformation has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public static Object getGeneralInformation(Model model) {
        Object information;

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java - About 3 hrs to fix

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

    public static List<Parameter> getParameter(Model model) {
        List<Parameter> parameters;

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java - About 3 hrs to fix

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

    public static Object getDataBackground(Model model) {
        Object background;

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java - About 3 hrs to fix

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

    public static Object getScope(Model model) {
        Object scope;

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java - About 3 hrs to fix

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

    public static Object getModelMath(Model model) {
        Object math;

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java - About 3 hrs to fix

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

    public static String getLanguageWrittenIn(Model model) {
        String language;

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java - About 3 hrs to fix

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

    public static void setParameter(Model model, List<Parameter> pList) {

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {
            ((GenericModel) model).getModelMath().setParameter(pList);
Severity: Minor
Found in de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java - About 3 hrs to fix

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

    @Deprecated
    public static de.bund.bfr.metadata.swagger.GenericModelModelMath convert(metadata.ModelMath emfMM) {

        de.bund.bfr.metadata.swagger.GenericModelModelMath swaggerMM = new de.bund.bfr.metadata.swagger.GenericModelModelMath();
        swaggerMM.setFittingProcedure(emfMM.getFittingProcedure());
Severity: Minor
Found in de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java - About 3 hrs to fix

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

    public static String getModelName(Model model) {
        String name;

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {

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

    public static String getModelId(Model model) {
        String name;

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {

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

    public static void setModelName(Model model, String name) {

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {
            ((GenericModel) model).getGeneralInformation().setName(name);

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

    public static void setModelId(Model model, String id) {

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {
            ((GenericModel) model).getGeneralInformation().setIdentifier(id);

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

    public static String getLanguageWrittenIn(Model model) {
        String language;

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {

Method getParameter has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static List<Parameter> getParameter(Model model) {
        List<Parameter> parameters;

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {

Method getDataBackground has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static Object getDataBackground(Model model) {
        Object background;

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {

Method getModelId has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static String getModelId(Model model) {
        String name;

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {

Method convert has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Deprecated
    public static de.bund.bfr.metadata.swagger.GenericModelGeneralInformation convert(
            metadata.GeneralInformation deprecatedGeneralInformation) {
        GenericModelGeneralInformation swaggerGI = new GenericModelGeneralInformation();

Method getScope has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static Object getScope(Model model) {
        Object scope;

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {

Method getModelName has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static String getModelName(Model model) {
        String name;

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {

Method getGeneralInformation has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static Object getGeneralInformation(Model model) {
        Object information;

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {

Method getModelMath has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static Object getModelMath(Model model) {
        Object math;

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {

Method convert has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Deprecated
    public static de.bund.bfr.metadata.swagger.GenericModelModelMath convert(metadata.ModelMath emfMM) {

        de.bund.bfr.metadata.swagger.GenericModelModelMath swaggerMM = new de.bund.bfr.metadata.swagger.GenericModelModelMath();
        swaggerMM.setFittingProcedure(emfMM.getFittingProcedure());

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

    public static void setParameter(Model model, List<Parameter> pList) {

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {
            ((GenericModel) model).getModelMath().setParameter(pList);

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

    public static void setModelName(Model model, String name) {

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {
            ((GenericModel) model).getGeneralInformation().setName(name);

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

    public static void setModelId(Model model, String id) {

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {
            ((GenericModel) model).getGeneralInformation().setIdentifier(id);

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

    public static de.bund.bfr.metadata.swagger.GenericModelModelMath convert(metadata.ModelMath emfMM) {

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 "consumptionModel" 11 times.
Open

        } else if (modelType.equalsIgnoreCase("consumptionModel")) {

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 "exposureModel" 11 times.
Open

        } else if (modelType.equalsIgnoreCase("exposureModel")) {

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 "dataModel" 11 times.
Open

        } else if (modelType.equalsIgnoreCase("dataModel")) {

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 "riskModel" 11 times.
Open

        } else if (modelType.equalsIgnoreCase("riskModel")) {

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 "qraModel" 11 times.
Open

        } else if (modelType.equalsIgnoreCase("qraModel")) {

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 "predictiveModel" 11 times.
Open

        } else if (modelType.equalsIgnoreCase("predictiveModel")) {

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 "healthModel" 11 times.
Open

        } else if (modelType.equalsIgnoreCase("healthModel")) {

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 "genericModel" 11 times.
Open

        if (modelType.equalsIgnoreCase("genericModel")) {

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 "otherModel" 11 times.
Open

        } else if (modelType.equalsIgnoreCase("otherModel")) {

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 "doseResponseModel" 11 times.
Open

        } else if (modelType.equalsIgnoreCase("doseResponseModel")) {

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 "processModel" 11 times.
Open

        } else if (modelType.equalsIgnoreCase("processModel")) {

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 "toxicologicalModel" 11 times.
Open

        } else if (modelType.equalsIgnoreCase("toxicologicalModel")) {

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.

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

    static {
        PUBLICATION_TYPE = new HashMap<PublicationType, PublicationTypeEnum>();

        PUBLICATION_TYPE.put(PublicationType.ABST, PublicationTypeEnum.ABST);
        PUBLICATION_TYPE.put(PublicationType.ADVS, PublicationTypeEnum.ADVS);
de.bund.bfr.knime.fsklab.metadata.model/src/de/bund/bfr/knime/fsklab/rakip/RakipUtil.java on lines 387..447

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

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 3 locations. Consider refactoring.
Open

    public static String getModelName(Model model) {
        String name;

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 567..600
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 706..739

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

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 3 locations. Consider refactoring.
Open

    public static List<Parameter> getParameter(Model model) {
        List<Parameter> parameters;

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 670..703
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 706..739

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

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 3 locations. Consider refactoring.
Open

    public static String getModelId(Model model) {
        String name;

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 567..600
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 670..703

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

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

    public static Object getDataBackground(Model model) {
        Object background;

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 799..832
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 834..867
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 904..937

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

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

    public static Object getGeneralInformation(Model model) {
        Object information;

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 834..867
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 869..902
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 904..937

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

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

    public static Object getScope(Model model) {
        Object scope;

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 799..832
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 869..902
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 904..937

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

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

    public static Object getModelMath(Model model) {
        Object math;

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 799..832
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 834..867
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 869..902

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

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 3 locations. Consider refactoring.
Open

    public static void setModelName(Model model, String name) {

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {
            ((GenericModel) model).getGeneralInformation().setName(name);
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 602..631
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 770..798

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

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 3 locations. Consider refactoring.
Open

    public static void setParameter(Model model, List<Parameter> pList) {

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {
            ((GenericModel) model).getModelMath().setParameter(pList);
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 741..769
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 770..798

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

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 3 locations. Consider refactoring.
Open

    public static void setModelId(Model model, String id) {

        final String modelType = model.getModelType();
        if (modelType.equalsIgnoreCase("genericModel")) {
            ((GenericModel) model).getGeneralInformation().setIdentifier(id);
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 602..631
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 741..769

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

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

    public static Parameter cloneParameter(Parameter old) {
        Parameter param = new Parameter();
        param.setClassification(old.getClassification());
        param.setDataType(old.getDataType());
        param.setDescription(old.getDescription());
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 312..332

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

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

    @Deprecated
    public static de.bund.bfr.metadata.swagger.Hazard convert(metadata.Hazard deprecated) {

        de.bund.bfr.metadata.swagger.Hazard hazard = new de.bund.bfr.metadata.swagger.Hazard();
        hazard.setType(deprecated.getHazardType());
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/SwaggerUtil.java on lines 939..956

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

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

    static {
        CLASSIF = new HashMap<>();

        CLASSIF.put(metadata.ParameterClassification.INPUT,
                de.bund.bfr.metadata.swagger.Parameter.ClassificationEnum.INPUT);
de.bund.bfr.knime.fsklab.metadata.model/src/de/bund/bfr/knime/fsklab/rakip/RakipUtil.java on lines 451..458

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

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

    public static LocalDate toLocalDate(Date date) {

        ZoneId defaultZoneId = ZoneId.systemDefault();

        int year = date.toInstant().atZone(defaultZoneId).toLocalDate().getYear();
de.bund.bfr.knime.fsklab.metadata.model/src/metadata/EmfMetadataModule.java on lines 329..338

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

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