SiLeBAT/FSK-Lab

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

Summary

Maintainability
F
1 wk
Test Coverage

Method setTsIDs has a Cognitive Complexity of 116 (exceeds 5 allowed). Consider refactoring.
Open

    public static HashMap<Integer, Integer> setTsIDs(boolean before, String attr,
            HashMap<Integer, Integer> foreignDbIds, KnimeTuple row, KnimeTuple schemaTuple) throws PmmException {
        int type = schemaTuple.getSchema().getType(row.getIndex(attr));
        if (type == KnimeAttribute.TYPE_XML) {
            PmmXmlDoc x = row.getPmmXml(attr);

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

    public static HashMap<Integer, Integer> setMIDs(boolean before, String attr, String dbTablename,
            HashMap<Integer, Integer> foreignDbIdsTable, KnimeTuple row, ParametricModel pm) throws PmmException {
        if (dbTablename.equals("Literatur")) {
            PmmXmlDoc lili = row.getPmmXml(attr);
            if (lili != null) {

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File CellIO.java has 410 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

Method setTsIDs has 106 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static HashMap<Integer, Integer> setTsIDs(boolean before, String attr,
            HashMap<Integer, Integer> foreignDbIds, KnimeTuple row, KnimeTuple schemaTuple) throws PmmException {
        int type = schemaTuple.getSchema().getType(row.getIndex(attr));
        if (type == KnimeAttribute.TYPE_XML) {
            PmmXmlDoc x = row.getPmmXml(attr);

Method setMIDs has 100 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static HashMap<Integer, Integer> setMIDs(boolean before, String attr, String dbTablename,
            HashMap<Integer, Integer> foreignDbIdsTable, KnimeTuple row, ParametricModel pm) throws PmmException {
        if (dbTablename.equals("Literatur")) {
            PmmXmlDoc lili = row.getPmmXml(attr);
            if (lili != null) {

Method getNameList has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public static List<String> getNameList(PmmXmlDoc xml) {
        List<String> names = new ArrayList<>();

        for (PmmXmlElementConvertable element : xml.getElementSet()) {
            if (element instanceof MiscXml) {

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

    public static List<String> getNameList(PmmXmlDoc xml) {
        List<String> names = new ArrayList<>();

        for (PmmXmlElementConvertable element : xml.getElementSet()) {
            if (element instanceof MiscXml) {

Avoid deeply nested control flow statements.
Open

                            if (before) {
                                pm.estModelId = foreignDbIdsTable.get(key);
                                emxDB.id = foreignDbIdsTable.get(key);
                                fromToXmlDB.set(i, emxDB);
                            } else if (foreignDbIdsTable.get(key).intValue() != emxDB.id.intValue()) {

Avoid deeply nested control flow statements.
Open

                            if (before) {
                                pm.modelId = foreignDbIdsTable.get(key);
                                cmxDB.id = foreignDbIdsTable.get(key);
                                fromToXmlDB.set(i, cmxDB);
                            } else if (foreignDbIdsTable.get(key).intValue() != cmxDB.id.intValue()) {

Method getDoubleList has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public static List<Double> getDoubleList(DataCell cell) {
        if (cell.isMissing()) {
            return new ArrayList<>();
        }

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Avoid deeply nested control flow statements.
Open

                        if (key != null && foreignDbIdsTable.containsKey(key)) {
                            if (before) {
                                liDB.id = foreignDbIdsTable.get(key);
                                fromToXmlDB.set(i, liDB);
                            } else if (foreignDbIdsTable.get(key).intValue() != liDB.id.intValue()) {

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

    public static HashMap<Integer, Integer> setMIDs(boolean before, String attr, String dbTablename,
            HashMap<Integer, Integer> foreignDbIdsTable, KnimeTuple row, ParametricModel pm) throws PmmException {

Method getIntList has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public static List<Integer> getIntList(DataCell cell) {
        if (cell.isMissing()) {
            return new ArrayList<>();
        }

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Avoid deeply nested control flow statements.
Open

                        if (key != null && key <= -1 && key >= -3)
                            continue; // ATT_TEMPERATURE_ID, ATT_PH_ID or

Avoid deeply nested control flow statements.
Open

                        if (key != null && foreignDbIds.containsKey(key)) {
                            if (before) {
                                mx2DB.id = foreignDbIds.get(key); // schemaTuple.addValue(attr,
                                                                    // foreignDbIds.get(key));
                                fromToXmlDB.set(i, mx2DB);

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

    public static HashMap<Integer, Integer> setTsIDs(boolean before, String attr,
            HashMap<Integer, Integer> foreignDbIds, KnimeTuple row, KnimeTuple schemaTuple) throws PmmException {

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

    public static HashMap<Integer, Integer> setMIDs(boolean before, String attr, String dbTablename,

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

    public static HashMap<Integer, Integer> setTsIDs(boolean before, String attr,

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

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

        } else if (attr.startsWith(Model1Schema.ATT_ESTMODEL)) { // GeschaetzteModelle
            PmmXmlDoc estModel = row.getPmmXml(attr);
            if (estModel != null) {
                PmmXmlDoc fromToXmlDB = pm.getEstModel();
                int i = 0;
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/CellIO.java on lines 339..371

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

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

        } else if (attr.startsWith(Model1Schema.ATT_MODELCATALOG)) { // Modellkatalog
            PmmXmlDoc modelCat = row.getPmmXml(attr);
            if (modelCat != null) {
                PmmXmlDoc fromToXmlDB = pm.getCatModel();
                int i = 0;
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/CellIO.java on lines 371..403

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

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

                        if (key != null && foreignDbIds.containsKey(key)) {
                            if (before) {
                                liDB.id = foreignDbIds.get(key); // schemaTuple.addValue(attr,
                                                                    // foreignDbIds.get(key));
                                fromToXmlDB.set(i, liDB);
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/CellIO.java on lines 425..440

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

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

                        if (key != null && foreignDbIds.containsKey(key)) {
                            if (before) {
                                mx2DB.id = foreignDbIds.get(key); // schemaTuple.addValue(attr,
                                                                    // foreignDbIds.get(key));
                                fromToXmlDB.set(i, mx2DB);
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/CellIO.java on lines 487..502

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

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 List<Integer> getIntList(DataCell cell) {
        if (cell.isMissing()) {
            return new ArrayList<>();
        }
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/CellIO.java on lines 132..153

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

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 List<Double> getDoubleList(DataCell cell) {
        if (cell.isMissing()) {
            return new ArrayList<>();
        }
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/CellIO.java on lines 161..182

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

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 DataCell createIntCell(String d) {
        if (d == null) {
            return createMissingCell();
        }
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/CellIO.java on lines 220..230

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

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

    public static DataCell createDoubleCell(String d) {
        if (d == null) {
            return createMissingCell();
        }
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/CellIO.java on lines 232..242

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