SiLeBAT/FSK-Lab

View on GitHub
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/modelanddatajoiner/SecondaryJoiner.java

Summary

Maintainability
F
1 wk
Test Coverage

Method getOutputTable has a Cognitive Complexity of 92 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public BufferedDataTable getOutputTable(String assignments,
            ExecutionContext exec) throws CanceledExecutionException,
            ConvertException {
        BufferedDataContainer buf = exec.createDataContainer(SchemaFactory

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 SecondaryJoiner.java has 550 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 getOutputTable has 151 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    public BufferedDataTable getOutputTable(String assignments,
            ExecutionContext exec) throws CanceledExecutionException,
            ConvertException {
        BufferedDataContainer buf = exec.createDataContainer(SchemaFactory

Method checkIfInputIsValid has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    private void checkIfInputIsValid() {
        Map<String, JComboBox<String>> depVarBoxes = new LinkedHashMap<>();
        isValid = true;

        for (String model : comboBoxes.keySet()) {

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

    @Override
    public JComponent createPanel(String assignments) {
        JPanel panel = new JPanel();
        JPanel topPanel = new JPanel();

Method addOrRemoveButtonPressed has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private void addOrRemoveButtonPressed(JButton button) {
        for (String model : addButtons.keySet()) {
            List<JButton> modelAddButtons = addButtons.get(model);
            List<JButton> modelRemoveButtons = removeButtons.get(model);
            List<Map<String, JComboBox<String>>> modelBoxes = comboBoxes

Method checkIfInputIsValid has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private void checkIfInputIsValid() {
        Map<String, JComboBox<String>> depVarBoxes = new LinkedHashMap<>();
        isValid = true;

        for (String model : comboBoxes.keySet()) {

Method readModelTable has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private void readModelTable() {
        models = new ArrayList<>();
        modelNames = new LinkedHashMap<>();
        modelFormulas = new LinkedHashMap<>();
        dependentVariables = new LinkedHashMap<>();

Method readDataTable has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private void readDataTable() {
        dependentParameters = new LinkedHashMap<>();
        primaryModelNames = new LinkedHashMap<>();
        independentParameterCategories = new LinkedHashMap<>();

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

    private void readDataTable() {
        dependentParameters = new LinkedHashMap<>();
        primaryModelNames = new LinkedHashMap<>();
        independentParameterCategories = new LinkedHashMap<>();

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 (primaryModelNames.get(id).equals(modelName)) {
                            modelID = id;
                            break;
                        }

Avoid deeply nested control flow statements.
Open

                        if (!CellIO.getNameList(params).contains(
                                newDepVarSecName)) {
                            continue;
                        }

Avoid deeply nested control flow statements.
Open

                        for (PmmXmlElementConvertable el : miscs
                                .getElementSet()) {
                            MiscXml element = (MiscXml) el;

                            if (paramsConvertTo.containsKey(element.name)) {

Avoid deeply nested control flow statements.
Open

                        if (!replace.containsKey(iv.name)) {
                            error = true;
                            break;
                        }

Avoid deeply nested control flow statements.
Open

                        if (!globalIds.containsKey(id)) {
                            globalIds.put(id,
                                    MathUtilities.getRandomNegativeInt());
                        }

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

    @Override
    public JComponent createPanel(String assignments) {
        JPanel panel = new JPanel();
        JPanel topPanel = new JPanel();

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 (id != modelID) {
                            continue;
                        }

Avoid deeply nested control flow statements.
Open

                        if (!tuplesByPrimID.containsKey(modelXml.id)) {
                            tuplesByPrimID.put(modelXml.id,
                                    new ArrayList<KnimeTuple>());
                        }

Avoid deeply nested control flow statements.
Open

                        for (String var : oldIndepVars) {
                            String unit = independentVariableUnits.get(model)
                                    .get(var);
                            String newVar = replace.get(var);

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

    private void addOrRemoveButtonPressed(JButton button) {
        for (String model : addButtons.keySet()) {
            List<JButton> modelAddButtons = addButtons.get(model);
            List<JButton> modelRemoveButtons = removeButtons.get(model);
            List<Map<String, JComboBox<String>>> modelBoxes = comboBoxes

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

    @Override
    public String getAssignments() {
        Map<String, List<Map<String, String>>> assignmentsMap = new LinkedHashMap<>();

        for (String model : comboBoxes.keySet()) {

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

    public BufferedDataTable getOutputTable(String assignments,

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

    private void checkIfInputIsValid() {

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

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

                    for (PmmXmlElementConvertable el : indepVarsSec
                            .getElementSet()) {
                        IndepXml iv = (IndepXml) el;

                        if (!replace.containsKey(iv.name)) {
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/modelanddatajoiner/CombinedJoiner.java on lines 266..279
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/modelanddatajoiner/CombinedJoiner.java on lines 286..299
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/modelanddatajoiner/PrimaryJoiner.java on lines 206..219

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

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 (box.getSelectedItem() == null) {
                        isValid = false;
                    } else {
                        JComboBox<String> sameValueBox = indepVarBoxes.get(box
                                .getSelectedItem());
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/modelanddatajoiner/SecondaryJoiner.java on lines 637..651

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

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

                if (box.getSelectedItem() == null) {
                    isValid = false;
                } else {
                    JComboBox<String> sameValueBox = depVarBoxes.get(box
                            .getSelectedItem());
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/modelanddatajoiner/SecondaryJoiner.java on lines 668..683

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

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

                    for (KnimeTuple dataTuple : dataTuples) {
                        CatalogModelXml modelXml = (CatalogModelXml) dataTuple
                                .getPmmXml(Model1Schema.ATT_MODELCATALOG)
                                .get(0);
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/fittedparameterview/TableReader.java on lines 101..111

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

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 List<String> getIndepParamsFromCategory(String category) {
        List<String> params = new ArrayList<>();

        for (String param : independentParameterCategories.keySet()) {
            if (category == null
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/modelanddatajoiner/CombinedJoiner.java on lines 551..562

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

            for (PmmXmlElementConvertable el : row.getPmmXml(
                    Model2Schema.ATT_INDEPENDENT).getElementSet()) {
                IndepXml element = (IndepXml) el;

                indepCategories.put(element.name, element.category);
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/ModelCombiner.java on lines 512..517
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/modelanddatajoiner/CombinedJoiner.java on lines 485..491
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/modelanddatajoiner/CombinedJoiner.java on lines 502..508
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/modelanddatajoiner/PrimaryJoiner.java on lines 367..373

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

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