SiLeBAT/FSK-Lab

View on GitHub
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/manualmodelconf/ui/MMC_M.java

Summary

Maintainability
F
2 wks
Test Coverage

File MMC_M.java has 1372 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 initComponents has 399 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @SuppressWarnings({ "serial" })
    private void initComponents() {
        // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
        // Generated using JFormDesigner non-commercial license
        depVarLabel = new JLabel();

MMC_M has 94 methods (exceeds 20 allowed). Consider refactoring.
Open

public class MMC_M extends JPanel {

    /**
     * 
     */

Method tableMouseClicked has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Open

    private void tableMouseClicked(MouseEvent e) {
        if (SwingUtilities.isLeftMouseButton(e)) {
            /*
             * int row = table.getSelectedRow(); int col =
             * table.getSelectedColumn();

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

    private void manageDBMinMax(ResultSet result, ParametricModel pm) throws SQLException {
        Array array = result.getArray(Bfrdb.ATT_PARAMNAME);
        Array arrayMin = result.getArray(Bfrdb.ATT_MINVALUE);
        Array arrayMax = result.getArray(Bfrdb.ATT_MAXVALUE);
        Array arrayCat = result.getArray("ParCategory");

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

    public void setPM(ParametricModel pm) {
        if (pm != null) {
            if (pm.getLevel() == 2) {
                if (!radioButton2.isSelected()) {
                    radioButton2.setSelected(true);

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

    private ParametricModel finalizePM(int lastSelIndex) {
        ParametricModel pm = table.getPM();
        if (table.hasChanged()) {
            if (pm != null && pm.modelName.equals(modelnameField.getText())) {
                modelnameField.setText(getNewModelname(pm));

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

    private void tableMouseClicked(MouseEvent e) {
        if (SwingUtilities.isLeftMouseButton(e)) {
            /*
             * int row = table.getSelectedRow(); int col =
             * table.getSelectedColumn();

Method setFromXmlString has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public void setFromXmlString(final String xmlString) {
        try {
            PmmXmlDoc doc = new PmmXmlDoc(xmlString);
            // fetch model set
            ParametricModel theModel = 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

Method listToDoc has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public PmmXmlDoc listToDoc() throws InvalidSettingsException {
        if (listModel == null || listModel.size() == 0) {
            if (m_mmcts != null && m_mmcts.getCondId() != null) getPM().condId = m_mmcts.getCondId();
            return toDoc();
        }

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

    private void loadFromDB() {
        ParametricModel ppm = table.getPM();
        modelNameBox.removeAllItems();
        // if (m_secondaryModels != null) m_secondaryModels.clear();
        int level = radioButton2.isSelected() ? 2 : 1;

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

    public void setInputData(Collection<ParametricModel> m1s, HashMap<ParametricModel, HashMap<String, ParametricModel>> m_secondaryModels, HashMap<Integer, PmmTimeSeries> tss) {
        this.tss = tss;
        this.m_secondaryModels = m_secondaryModels;
        if (m1s.size() == 0) {
            scrollPane3.setVisible(false);

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

    private void manageDBMinMax(ResultSet result, ParametricModel pm) throws SQLException {
        Array array = result.getArray(Bfrdb.ATT_PARAMNAME);
        Array arrayMin = result.getArray(Bfrdb.ATT_MINVALUE);
        Array arrayMax = result.getArray(Bfrdb.ATT_MAXVALUE);
        Array arrayCat = result.getArray("ParCategory");

Method setPM has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public void setPM(ParametricModel pm) {
        if (pm != null) {
            if (pm.getLevel() == 2) {
                if (!radioButton2.isSelected()) {
                    radioButton2.setSelected(true);

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

    private void parseFormula(ParametricModel oldPM, ParametricModel newPM) {
        String formula = MathUtilities.getFormula(formulaArea.getText(), boundaryArea.getText());
        formula = formula.replaceAll("\n", "");
        formula = formula.replaceAll("\\s", "");
        formula = formula.replace("~", "=").trim();

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

    private void loadFromDB() {
        ParametricModel ppm = table.getPM();
        modelNameBox.removeAllItems();
        // if (m_secondaryModels != null) m_secondaryModels.clear();
        int level = radioButton2.isSelected() ? 2 : 1;

Method parseFormula has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private void parseFormula(ParametricModel oldPM, ParametricModel newPM) {
        String formula = MathUtilities.getFormula(formulaArea.getText(), boundaryArea.getText());
        formula = formula.replaceAll("\n", "");
        formula = formula.replaceAll("\\s", "");
        formula = formula.replace("~", "=").trim();

Method finalizePM has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private ParametricModel finalizePM(int lastSelIndex) {
        ParametricModel pm = table.getPM();
        if (table.hasChanged()) {
            if (pm != null && pm.modelName.equals(modelnameField.getText())) {
                modelnameField.setText(getNewModelname(pm));

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

    public void setFromXmlString(final String xmlString) {
        try {
            PmmXmlDoc doc = new PmmXmlDoc(xmlString);
            // fetch model set
            ParametricModel theModel = null;

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

    public void setInputData(Collection<ParametricModel> m1s, HashMap<ParametricModel, HashMap<String, ParametricModel>> m_secondaryModels, HashMap<Integer, PmmTimeSeries> tss) {
        this.tss = tss;
        this.m_secondaryModels = m_secondaryModels;
        if (m1s.size() == 0) {
            scrollPane3.setVisible(false);

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

    private String manageIndep(ParametricModel pm, ResultSet rs) throws SQLException {
        String result = null;
        Array array = rs.getArray(Bfrdb.ATT_INDEP);
        Array min = rs.getArray(Bfrdb.ATT_MININDEP);
        Array max = rs.getArray(Bfrdb.ATT_MAXINDEP);

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

    private String manageIndep(ParametricModel pm, ResultSet rs) throws SQLException {
        String result = null;
        Array array = rs.getArray(Bfrdb.ATT_INDEP);
        Array min = rs.getArray(Bfrdb.ATT_MININDEP);
        Array max = rs.getArray(Bfrdb.ATT_MAXINDEP);

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

    private void doLit(LiteratureItem oldLi, Boolean isEM) {
        MyTable lit = DBKernel.myDBi.getTable("Literatur");
        Integer litID = (oldLi != null && (dbuuid != null && dbuuid.equals(oldLi.dbuuid))) ? oldLi.id : null;
        Integer newVal = (Integer) DBKernel.mainFrame.openNewWindow(lit, litID, (Object) "Literatur", null, 1, 1, null, true, null, this);
        if (newVal != null && newVal instanceof Integer) {

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 (e.isShiftDown()) {
                            pm.setDepCategory(null);
                            pm.setDepUnit(null);
                            return;
                        }

Avoid deeply nested control flow statements.
Open

                        if (!pm_.equals(pmAll) && pmAll.estModelId == pm_.estModelId) {
                            System.err.println("WEW");
                        }

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

    private PmmXmlDoc toDoc() throws InvalidSettingsException {
        PmmXmlDoc doc = new PmmXmlDoc();

        ParametricModel pm = finalizePM(-1);

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 (row == 0) {
                            pm.setDepCategory(categoryStr);
                            pm.setDepUnit(unit);
                        } else if (isIndep != null && isIndep instanceof Boolean && ((Boolean) isIndep)) {
                            pm.setIndepCategory(param, categoryStr);

Consider simplifying this complex logical expression.
Open

                if (o != null && o.length > 0) {
                    for (int i = 0; i < o.length; i++) {
                        pm.addIndepVar(o[i].toString(), mi == null || mi[i] == null ? null : Double.parseDouble(mi[i].toString()),
                                ma == null || ma[i] == null ? null : Double.parseDouble(ma[i].toString()), c == null || c[i] == null ? null : c[i].toString(), u == null
                                        || u[i] == null ? null : u[i].toString(), d[i] == null ? null : d[i].toString());

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

                    public Component getListCellRendererComponent(JList<?> list,
                            Object value, int index, boolean isSelected,
                            boolean cellHasFocus) {

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

    private void list1ValueChanged(ListSelectionEvent e) {
        if (!dontFireList && !e.getValueIsAdjusting() && list1.getSelectedIndex() >= 0) {
            if (list1.getSelectedIndex() != e.getFirstIndex()) finalizePM(e.getFirstIndex());
            ParametricModel pm1 = list1.getSelectedValue();
            if (m_secondaryModels.get(pm1) != null && m_secondaryModels.get(pm1).size() > 0) {

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

    private void cloneSecondary(ParametricModel pm, ParametricModel newPM) {
        HashMap<String, ParametricModel> smOld = m_secondaryModels.get(pm);
        if (smOld != null && !m_secondaryModels.containsKey(newPM)) {
            HashMap<String, ParametricModel> smNew = new HashMap<>();
            for (String key : smOld.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 modelNameBoxActionPerformed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private void modelNameBoxActionPerformed(ActionEvent e) {
        if (dontTouch) return;
        table.clearTable();
        // if (!dontRemoveSec && m_secondaryModels != null)
        // m_secondaryModels.clear();

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

    private void tableMouseClicked(MouseEvent e) {

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 String manageIndep(ParametricModel pm, ResultSet rs) throws SQLException {

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

See

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

    public void setFromXmlString(final String xmlString) {

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

    private ParametricModel finalizePM(int lastSelIndex) {

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

    private void manageDBMinMax(ResultSet result, ParametricModel pm) throws SQLException {

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

See

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

    public PmmXmlDoc listToDoc() throws InvalidSettingsException {

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

    public void setPM(ParametricModel pm) {

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

        formula = formula.replaceAll("\n", "");

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

Make "m_conn" transient or serializable.
Open

    private Connection m_conn = null;

Fields in a Serializable class must themselves be either Serializable or transient even if the class is never explicitly serialized or deserialized. For instance, under load, most J2EE application frameworks flush objects to disk, and an allegedly Serializable object with non-transient, non-serializable data members could cause program crashes, and open the door to attackers. In general a Serializable class is expected to fulfil its contract and not have an unexpected behaviour when an instance is serialized.

This rule raises an issue on non-Serializable fields, and on collection fields when they are not private (because they could be assigned non-Serializable values externally), and when they are assigned non-Serializable types within the class.

Noncompliant Code Example

public class Address {
  //...
}

public class Person implements Serializable {
  private static final long serialVersionUID = 1905122041950251207L;

  private String name;
  private Address address;  // Noncompliant; Address isn't serializable
}

Compliant Solution

public class Address implements Serializable {
  private static final long serialVersionUID = 2405172041950251807L;
}

public class Person implements Serializable {
  private static final long serialVersionUID = 1905122041950251207L;

  private String name;
  private Address address;
}

Exceptions

The alternative to making all members serializable or transient is to implement special methods which take on the responsibility of properly serializing and de-serializing the object. This rule ignores classes which implement the following methods:

 private void writeObject(java.io.ObjectOutputStream out)
     throws IOException
 private void readObject(java.io.ObjectInputStream in)
     throws IOException, ClassNotFoundException;

See

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

        for (String s : DBKernel.myDBi.getHashMap("ModelType").values()) {

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

                    @Override
                    protected void paintComponent(Graphics g) {
                        Rectangle rect = g.getClipBounds();

                        if (rect != null) {
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/ui/QualityComboBox.java on lines 96..115

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

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 (oMin != null && oMin.length > ii && oMin[ii] != null) {
                            pm.setParamMin(o[ii].toString(), Double.parseDouble(oMin[ii].toString()));
                        }
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/manualmodelconf/ui/MMC_M.java on lines 300..302

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

                        if (oMax != null && oMax.length > ii && oMax[ii] != null) {
                            pm.setParamMax(o[ii].toString(), Double.parseDouble(oMax[ii].toString()));
                        }
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/manualmodelconf/ui/MMC_M.java on lines 297..299

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

            if (m_secondaryModels.containsKey(pm1)) {
                for (Map.Entry<String, ParametricModel> entry : m_secondaryModels.get(pm1).entrySet()) {
                    String key = entry.getKey();
                    if (pm1.containsParam(key)) {
                        ParametricModel value = entry.getValue();
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/manualmodelconf/ui/MMC_M.java on lines 765..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 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

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

        if (radioButton3.isSelected()) {
            for (Map.Entry<String, ParametricModel> entry : m_secondaryModels.get(pm).entrySet()) {
                String key = entry.getKey();
                if (pm.containsParam(key)) {
                    ParametricModel value = entry.getValue();
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/manualmodelconf/ui/MMC_M.java on lines 722..730

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

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

                        if (isIndep != null && isIndep instanceof Boolean && ((Boolean) isIndep)) {
                            if (e.isShiftDown()) {
                                pm.setIndepCategory(param, null);
                                pm.setIndepUnit(param, null);
                                return;
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/manualmodelconf/ui/MMC_M.java on lines 581..589

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

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

                        } else {
                            if (e.isShiftDown()) {
                                pm.setParamCategory(param, null);
                                pm.setParamUnit(param, null);
                                return;
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/manualmodelconf/ui/MMC_M.java on lines 573..581

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

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

                        if (oCat != null && oCat.length > ii && oCat[ii] != null) {
                            pm.setParamCategory(o[ii].toString(), oCat[ii].toString());
                        }
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/manualmodelconf/ui/MMC_M.java on lines 306..308
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/manualmodelconf/ui/MMC_M.java on lines 309..311

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

                        if (oUnit != null && oUnit.length > ii && oUnit[ii] != null) {
                            pm.setParamUnit(o[ii].toString(), oUnit[ii].toString());
                        }
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/manualmodelconf/ui/MMC_M.java on lines 303..305
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/manualmodelconf/ui/MMC_M.java on lines 309..311

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

                        if (oDesc != null && oDesc.length > ii && oDesc[ii] != null) {
                            pm.setParamDescription(o[ii].toString(), oDesc[ii].toString());
                        }
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/manualmodelconf/ui/MMC_M.java on lines 303..305
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/manualmodelconf/ui/MMC_M.java on lines 306..308

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

    private void textField1FocusLost(FocusEvent e) {
        ParametricModel pm = table.getPM();
        if (pm != null) {
            try {
                pm.comment = textField1.getText();
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/manualmodelconf/ui/MMC_M.java on lines 974..983
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/manualmodelconf/ui/MMC_M.java on lines 985..994

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

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

    private void checkBox1ActionPerformed(ActionEvent e) {
        ParametricModel pm = table.getPM();
        if (pm != null) {
            try {
                pm.isChecked = checkBox1.isSelected();
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/manualmodelconf/ui/MMC_M.java on lines 974..983
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/manualmodelconf/ui/MMC_M.java on lines 1096..1105

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

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

    private void qScoreBoxActionPerformed(ActionEvent e) {
        ParametricModel pm = table.getPM();
        if (pm != null) {
            try {
                pm.qualityScore = qScoreBox.getSelectedIndex();
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/manualmodelconf/ui/MMC_M.java on lines 985..994
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/manualmodelconf/ui/MMC_M.java on lines 1096..1105

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

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 void r2FieldFocusLost(FocusEvent e) {
        ParametricModel pm = table.getPM();
        if (pm != null) {
            try {
                pm.setRsquared(r2Field.getValue());
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/manualmodelconf/ui/MMC_M.java on lines 931..940

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

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 void rmsFieldFocusLost(FocusEvent e) {
        ParametricModel pm = table.getPM();
        if (pm != null) {
            try {
                pm.setRms(rmsField.getValue());
de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/manualmodelconf/ui/MMC_M.java on lines 914..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 48.

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

                    @Override
                    public Component getListCellRendererComponent(JList<?> list,
                            Object value, int index, boolean isSelected,
                            boolean cellHasFocus) {
                        color = (Color) value;
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/ui/QualityComboBox.java on lines 85..94

Duplicated Code

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

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

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

Tuning

This issue has a mass of 44.

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

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

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

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

Refactorings

Further Reading

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

        } else {
            depVarLabel.setVisible(true);
            radioButton2.setSelected(true);
            radioButton1.setEnabled(false);
            radioButton2.setEnabled(false);
de.bund.bfr.knime.pmm.common/src/de/bund/bfr/knime/pmm/common/ui/DateInputDialog.java on lines 561..567

Duplicated Code

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

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

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

Tuning

This issue has a mass of 42.

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

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

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

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

Refactorings

Further Reading

There are no issues that match your filters.

Category
Status