CloudSlang/cs-actions

View on GitHub
cs-vmware/src/main/java/io/cloudslang/content/vmware/connection/helpers/WaitForValues.java

Summary

Maintainability
C
1 day
Test Coverage

Method wait has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    public Object[] wait(ManagedObjectReference objMor, String[] filterProps, String[] endWaitProps, Object[][] expectedValues)
            throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg, InvalidCollectorVersionFaultMsg {

        String version = Constants.EMPTY;
        String stateVal = 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 wait has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public Object[] wait(ManagedObjectReference objMor, String[] filterProps, String[] endWaitProps, Object[][] expectedValues)
            throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg, InvalidCollectorVersionFaultMsg {

        String version = Constants.EMPTY;
        String stateVal = null;

    Avoid deeply nested control flow statements.
    Open

                            for (PropertyChange propchg : objup.getChangeSet()) {
                                updateValues(endWaitProps, endValues, propchg);
                                updateValues(filterProps, filterValues, propchg);
                            }

      Avoid deeply nested control flow statements.
      Open

                              if (stateElement != null && stateElement.getFirstChild() != null) {
                                  stateVal = stateElement.getFirstChild().getTextContent();
                                  reached = expctdval.toString().equalsIgnoreCase(stateVal);
                              }

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

            private void updateValues(String[] props, Object[] vals, PropertyChange propchg) {
                for (int findi = 0; findi < props.length; findi++) {
                    if (propchg.getName().lastIndexOf(props[findi]) >= 0) {
                        vals[findi] = propchg.getOp() == PropertyChangeOp.REMOVE ? Constants.EMPTY : propchg.getVal();
                    }

        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

        There are no issues that match your filters.

        Category
        Status