SiLeBAT/FSK-Lab

View on GitHub
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/ParametricModel.java

Summary

Maintainability
F
1 wk
Test Coverage

File ParametricModel.java has 862 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

ParametricModel has 92 methods (exceeds 20 allowed). Consider refactoring.
Open

public class ParametricModel implements PmmXmlElementConvertable {

    public static final String ELEMENT_PARAMETRICMODEL = "ParametricModel";

    // hier fest verdrahtet und von den zentralen KnimSchema Variablen unabhängig

Method revertFormula has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public String revertFormula() {
        String result = formula;
        if (depXml != null && !depXml.name.equals(depXml.origName)) {
            result = MathUtilities.replaceVariable(result, depXml.name, depXml.origName);
        }

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

    public SortedMap<String, Boolean> getAllParVars() {
        SortedMap<String, Boolean> result = new TreeMap<>();
        if (parameter != null && parameter.getElementSet() != null) {
            for (PmmXmlElementConvertable el : parameter.getElementSet()) {
                if (el instanceof ParamXml) {

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

    public ParametricModel clone() {
        ParametricModel clonedPM = new ParametricModel(modelName, formula, depXml, level, modelId, estModelId);
        clonedPM.modelClass = modelClass;
        clonedPM.modelDbUuid = modelDbUuid;
        clonedPM.estimatedModelDbUuid = estimatedModelDbUuid;

Method toXmlElement has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    public Element toXmlElement() {
        Element modelElement = new Element(ELEMENT_PARAMETRICMODEL);
        modelElement.setAttribute(ATT_MDBUUID, modelDbUuid == null ? "" : modelDbUuid);
        modelElement.setAttribute(ATT_EMDBUUID, estimatedModelDbUuid == null ? "" : estimatedModelDbUuid);

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

    public KnimeTuple getKnimeTuple() throws PmmException {
        KnimeTuple tuple;

        if (level == 1) {

Method addParam has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public void addParam(final String paramName, final Boolean isStartParam, final Double value, final Double error,
            final Double min, final Double max, String category, String unit, String description) {

Consider simplifying this complex logical expression.
Open

            } else if (el.getName().equals(ELEMENT_PARAM)) {
                boolean minNull = el.getAttributeValue(ATT_MINVALUE) == null
                        || el.getAttributeValue(ATT_MINVALUE).equals("null");
                boolean maxNull = el.getAttributeValue(ATT_MAXVALUE) == null
                        || el.getAttributeValue(ATT_MAXVALUE).equals("null");

Method clone has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public ParametricModel clone() {
        ParametricModel clonedPM = new ParametricModel(modelName, formula, depXml, level, modelId, estModelId);
        clonedPM.modelClass = modelClass;
        clonedPM.modelDbUuid = modelDbUuid;
        clonedPM.estimatedModelDbUuid = estimatedModelDbUuid;

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 addIndepVar has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public void addIndepVar(final String varName, final Double min, final Double max, String category, String unit,
            String description) {

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

    public void addParam(final String paramName, final Boolean isStartParam, final Double value, final Double error,
            final Double min, final Double max) {

Method findParam has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private ParamXml findParam(final String name) {
        for (PmmXmlElementConvertable el : parameter.getElementSet()) {
            if (el instanceof ParamXml) {
                ParamXml px = (ParamXml) el;
                if (px.name.equals(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 removeParam has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public void removeParam(final String varName) {
        for (PmmXmlElementConvertable el : parameter.getElementSet()) {
            if (el instanceof ParamXml) {
                ParamXml px = (ParamXml) el;
                if (px.name.equals(varName)) {

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

    public void setRms(final Double rms) throws PmmException {
        if (rms == null)
            this.rms = Double.NaN;
        else {
            if (Double.isInfinite(rms)) {

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

    public void setRss(final Double rss) throws PmmException {
        if (rss == null)
            this.rss = Double.NaN;
        else {
            if (Double.isInfinite(rss)) {

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

    public void removeIndepVar(final String varName) {
        for (PmmXmlElementConvertable el : independent.getElementSet()) {
            if (el instanceof IndepXml) {
                IndepXml ix = (IndepXml) el;
                if (ix.name.equals(varName)) {

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

    private IndepXml findIndep(final String name) {
        for (PmmXmlElementConvertable el : independent.getElementSet()) {
            if (el instanceof IndepXml) {
                IndepXml indep = (IndepXml) el;
                if (indep.name.equals(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

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

    public ParametricModel(KnimeTuple row, int level, Integer newTsID) throws PmmException {

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 24 to the 15 allowed.
Open

    public String revertFormula() {

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 112 to the 15 allowed.
Open

    public ParametricModel(final Element modelElement) {

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

Replace this call to "replaceAll()" by a call to the "replace()" method.
Open

        this.formula = formula.replaceAll("~", "=");

The underlying implementation of String::replaceAll calls the java.util.regex.Pattern.compile() method each time it is called even if the first argument is not a regular expression. This has a significant performance cost and therefore should be used with care.

When String::replaceAll is used, the first argument should be a real regular expression. If it’s not the case, String::replace does exactly the same thing as String::replaceAll without the performance drawback of the regex.

This rule raises an issue for each String::replaceAll used with a String as first parameter which doesn’t contains special regex character or pattern.

Noncompliant Code Example

String init = "Bob is a Bird... Bob is a Plane... Bob is Superman!";
String changed = init.replaceAll("Bob is", "It's"); // Noncompliant
changed = changed.replaceAll("\\.\\.\\.", ";"); // Noncompliant

Compliant Solution

String init = "Bob is a Bird... Bob is a Plane... Bob is Superman!";
String changed = init.replace("Bob is", "It's");
changed = changed.replace("...", ";");

Or, with a regex:

String init = "Bob is a Bird... Bob is a Plane... Bob is Superman!";
String changed = init.replaceAll("\\w*\\sis", "It's");
changed = changed.replaceAll("\\.{3}", ";");

See

  • {rule:java:S4248} - Regex patterns should not be created needlessly

Remove this "clone" implementation; use a copy constructor or copy factory instead.
Open

    public ParametricModel clone() {

Many consider clone and Cloneable broken in Java, largely because the rules for overriding clone are tricky and difficult to get right, according to Joshua Bloch:

Object's clone method is very tricky. It's based on field copies, and it's "extra-linguistic." It creates an object without calling a constructor. There are no guarantees that it preserves the invariants established by the constructors. There have been lots of bugs over the years, both in and outside Sun, stemming from the fact that if you just call super.clone repeatedly up the chain until you have cloned an object, you have a shallow copy of the object. The clone generally shares state with the object being cloned. If that state is mutable, you don't have two independent objects. If you modify one, the other changes as well. And all of a sudden, you get random behavior.

A copy constructor or copy factory should be used instead.

This rule raises an issue when clone is overridden, whether or not Cloneable is implemented.

Noncompliant Code Example

public class MyClass {
  // ...

  public Object clone() { // Noncompliant
    //...
  }
}

Compliant Solution

public class MyClass {
  // ...

  MyClass (MyClass source) {
    //...
  }
}

See

See Also

  • {rule:java:S2157} - "Cloneables" should implement "clone"
  • {rule:java:S1182} - Classes that override "clone" should be "Cloneable" and call "super.clone()"

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

        if (modelElement.getAttributeValue("FittedModelName") != null

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

                boolean categoryNull = el.getAttributeValue("Category") == null

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

        if (parameter != null && parameter.getElementSet() != null) {
            for (PmmXmlElementConvertable el : parameter.getElementSet()) {
                if (el instanceof ParamXml) {
                    ParamXml px = (ParamXml) el;
                    if (!px.name.equals(px.origName)) {
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/ParametricModel.java on lines 807..816

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

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 (independent != null && independent.getElementSet() != null) {
            for (PmmXmlElementConvertable el : independent.getElementSet()) {
                if (el instanceof IndepXml) {
                    IndepXml ix = (IndepXml) el;
                    if (!ix.name.equals(ix.origName)) {
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/ParametricModel.java on lines 797..806

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

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 void setRms(final Double rms) throws PmmException {
        if (rms == null)
            this.rms = Double.NaN;
        else {
            if (Double.isInfinite(rms)) {
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/ParametricModel.java on lines 759..773

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

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 void setRss(final Double rss) throws PmmException {
        if (rss == null)
            this.rss = Double.NaN;
        else {
            if (Double.isInfinite(rss)) {
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/ParametricModel.java on lines 734..748

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

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 (independent != null && independent.getElementSet() != null) {
            for (PmmXmlElementConvertable el : independent.getElementSet()) {
                if (el instanceof IndepXml) {
                    IndepXml ix = (IndepXml) el;
                    result.put(ix.name, true);
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/ParametricModel.java on lines 958..965

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

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 (parameter != null && parameter.getElementSet() != null) {
            for (PmmXmlElementConvertable el : parameter.getElementSet()) {
                if (el instanceof ParamXml) {
                    ParamXml px = (ParamXml) el;
                    result.put(px.name, false);
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/ParametricModel.java on lines 966..973

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

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 void removeParam(final String varName) {
        for (PmmXmlElementConvertable el : parameter.getElementSet()) {
            if (el instanceof ParamXml) {
                ParamXml px = (ParamXml) el;
                if (px.name.equals(varName)) {
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/ParametricModel.java on lines 901..911

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 58.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    public void removeIndepVar(final String varName) {
        for (PmmXmlElementConvertable el : independent.getElementSet()) {
            if (el instanceof IndepXml) {
                IndepXml ix = (IndepXml) el;
                if (ix.name.equals(varName)) {
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/ParametricModel.java on lines 913..923

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 58.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

                for (PmmXmlElementConvertable el : parameter.getElementSet()) {
                    if (el instanceof ParamXml) {
                        ParamXml px = (ParamXml) el;
                        if (px.origName.equals(origName)) {
                            px.name = name;
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/ParametricModel.java on lines 378..386

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

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

                for (PmmXmlElementConvertable el : independent.getElementSet()) {
                    if (el instanceof IndepXml) {
                        IndepXml ix = (IndepXml) el;
                        if (ix.origName.equals(origName)) {
                            ix.name = name;
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/ParametricModel.java on lines 369..377

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

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

    private ParamXml findParam(final String name) {
        for (PmmXmlElementConvertable el : parameter.getElementSet()) {
            if (el instanceof ParamXml) {
                ParamXml px = (ParamXml) el;
                if (px.name.equals(name)) {
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/ParametricModel.java on lines 470..480

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

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

    private IndepXml findIndep(final String name) {
        for (PmmXmlElementConvertable el : independent.getElementSet()) {
            if (el instanceof IndepXml) {
                IndepXml indep = (IndepXml) el;
                if (indep.name.equals(name)) {
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/ParametricModel.java on lines 569..579

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

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 (modelElement.getAttributeValue(ATT_QSCORE) != null && !modelElement.getAttributeValue(ATT_QSCORE).isEmpty())
            qualityScore = Integer.valueOf(modelElement.getAttributeValue(ATT_QSCORE));
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/ParametricModel.java on lines 263..265

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

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 (modelElement.getAttributeValue(ATT_CHECKED) != null
                && !modelElement.getAttributeValue(ATT_CHECKED).isEmpty())
            isChecked = Boolean.valueOf(modelElement.getAttributeValue(ATT_CHECKED));
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/ParametricModel.java on lines 269..270

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

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