SiLeBAT/FSK-Lab

View on GitHub
de.bund.bfr.knime.fsklab.metadata.model/gen/metadata/impl/AssayImpl.java

Summary

Maintainability
D
1 day
Test Coverage

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

    @Override
    public boolean eIsSet(int featureID) {
        switch (featureID) {
            case MetadataPackage.ASSAY__ASSAY_NAME:
                return ASSAY_NAME_EDEFAULT == null ? assayName != null : !ASSAY_NAME_EDEFAULT.equals(assayName);

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

AssayImpl has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

public class AssayImpl extends MinimalEObjectImpl.Container implements Assay {
    /**
     * The default value of the '{@link #getAssayName() <em>Assay Name</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->

File AssayImpl.java has 254 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 */
package metadata.impl;

import metadata.Assay;

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

    @Override
    public void eUnset(int featureID) {
        switch (featureID) {
            case MetadataPackage.ASSAY__ASSAY_NAME:
                setAssayName(ASSAY_NAME_EDEFAULT);

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

    @Override
    public void eSet(int featureID, Object newValue) {
        switch (featureID) {
            case MetadataPackage.ASSAY__ASSAY_NAME:
                setAssayName((String)newValue);

Avoid too many return statements within this method.
Open

                return;
Severity: Major
Found in de.bund.bfr.knime.fsklab.metadata.model/gen/metadata/impl/AssayImpl.java - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return;
Severity: Major
Found in de.bund.bfr.knime.fsklab.metadata.model/gen/metadata/impl/AssayImpl.java - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return;
Severity: Major
Found in de.bund.bfr.knime.fsklab.metadata.model/gen/metadata/impl/AssayImpl.java - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return;
Severity: Major
Found in de.bund.bfr.knime.fsklab.metadata.model/gen/metadata/impl/AssayImpl.java - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return;
Severity: Major
Found in de.bund.bfr.knime.fsklab.metadata.model/gen/metadata/impl/AssayImpl.java - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return;
Severity: Major
Found in de.bund.bfr.knime.fsklab.metadata.model/gen/metadata/impl/AssayImpl.java - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return;
Severity: Major
Found in de.bund.bfr.knime.fsklab.metadata.model/gen/metadata/impl/AssayImpl.java - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return;
Severity: Major
Found in de.bund.bfr.knime.fsklab.metadata.model/gen/metadata/impl/AssayImpl.java - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return;
Severity: Major
Found in de.bund.bfr.knime.fsklab.metadata.model/gen/metadata/impl/AssayImpl.java - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return;
Severity: Major
Found in de.bund.bfr.knime.fsklab.metadata.model/gen/metadata/impl/AssayImpl.java - About 30 mins to fix

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

    public boolean eIsSet(int featureID) {

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

Add a default case to this switch.
Open

        switch (featureID) {

The requirement for a final default clause is defensive programming. The clause should either take appropriate action, or contain a suitable comment as to why no action is taken.

Noncompliant Code Example

switch (param) {  //missing default clause
  case 0:
    doSomething();
    break;
  case 1:
    doSomethingElse();
    break;
}

switch (param) {
  default: // default clause should be the last one
    error();
    break;
  case 0:
    doSomething();
    break;
  case 1:
    doSomethingElse();
    break;
}

Compliant Solution

switch (param) {
  case 0:
    doSomething();
    break;
  case 1:
    doSomethingElse();
    break;
  default:
    error();
    break;
}

Exceptions

If the switch parameter is an Enum and if all the constants of this enum are used in the case statements, then no default clause is expected.

Example:

public enum Day {
    SUNDAY, MONDAY
}
...
switch(day) {
  case SUNDAY:
    doSomething();
    break;
  case MONDAY:
    doSomethingElse();
    break;
}

See

Add a default case to this switch.
Open

        switch (featureID) {

The requirement for a final default clause is defensive programming. The clause should either take appropriate action, or contain a suitable comment as to why no action is taken.

Noncompliant Code Example

switch (param) {  //missing default clause
  case 0:
    doSomething();
    break;
  case 1:
    doSomethingElse();
    break;
}

switch (param) {
  default: // default clause should be the last one
    error();
    break;
  case 0:
    doSomething();
    break;
  case 1:
    doSomethingElse();
    break;
}

Compliant Solution

switch (param) {
  case 0:
    doSomething();
    break;
  case 1:
    doSomethingElse();
    break;
  default:
    error();
    break;
}

Exceptions

If the switch parameter is an Enum and if all the constants of this enum are used in the case statements, then no default clause is expected.

Example:

public enum Day {
    SUNDAY, MONDAY
}
...
switch(day) {
  case SUNDAY:
    doSomething();
    break;
  case MONDAY:
    doSomethingElse();
    break;
}

See

Add a default case to this switch.
Open

        switch (featureID) {

The requirement for a final default clause is defensive programming. The clause should either take appropriate action, or contain a suitable comment as to why no action is taken.

Noncompliant Code Example

switch (param) {  //missing default clause
  case 0:
    doSomething();
    break;
  case 1:
    doSomethingElse();
    break;
}

switch (param) {
  default: // default clause should be the last one
    error();
    break;
  case 0:
    doSomething();
    break;
  case 1:
    doSomethingElse();
    break;
}

Compliant Solution

switch (param) {
  case 0:
    doSomething();
    break;
  case 1:
    doSomethingElse();
    break;
  default:
    error();
    break;
}

Exceptions

If the switch parameter is an Enum and if all the constants of this enum are used in the case statements, then no default clause is expected.

Example:

public enum Day {
    SUNDAY, MONDAY
}
...
switch(day) {
  case SUNDAY:
    doSomething();
    break;
  case MONDAY:
    doSomethingElse();
    break;
}

See

Add a default case to this switch.
Open

        switch (featureID) {

The requirement for a final default clause is defensive programming. The clause should either take appropriate action, or contain a suitable comment as to why no action is taken.

Noncompliant Code Example

switch (param) {  //missing default clause
  case 0:
    doSomething();
    break;
  case 1:
    doSomethingElse();
    break;
}

switch (param) {
  default: // default clause should be the last one
    error();
    break;
  case 0:
    doSomething();
    break;
  case 1:
    doSomethingElse();
    break;
}

Compliant Solution

switch (param) {
  case 0:
    doSomething();
    break;
  case 1:
    doSomethingElse();
    break;
  default:
    error();
    break;
}

Exceptions

If the switch parameter is an Enum and if all the constants of this enum are used in the case statements, then no default clause is expected.

Example:

public enum Day {
    SUNDAY, MONDAY
}
...
switch(day) {
  case SUNDAY:
    doSomething();
    break;
  case MONDAY:
    doSomethingElse();
    break;
}

See

There are no issues that match your filters.

Category
Status