zk/src/main/java/org/zkoss/zk/ui/sys/StubsComponent.java

Summary

Maintainability
D
1 day
Test Coverage

Method mapChildren has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

    protected void mapChildren(DesktopCtrl desktopCtrl, List<String> uuids, List<String[]> idmap, List<Object[]> evtmap,
            Component comp) {
        for (Component p = comp.getFirstChild(); p != null; p = p.getNextSibling()) {
            if (p instanceof StubsComponent) {
                final String[] kiduuids = ((StubsComponent) p)._uuids;
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/sys/StubsComponent.java - About 6 hrs to fix

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

    public String toString() {
        final StringBuffer sb = new StringBuffer(super.toString());
        if (_uuids != null) {
            sb.append('(');
            for (int j = 0; j < _uuids.length; ++j) {
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/sys/StubsComponent.java - About 1 hr to fix

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

    public void service(Event event, Scope scope) throws Exception {
        final StubEvent stubevt = event instanceof StubEvent ? (StubEvent) event : null;
        final String uuid = stubevt != null ? stubevt.getUuid() : null;
        if (uuid == null || uuid.equals(getUuid())) {
            super.service(event, scope);
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/sys/StubsComponent.java - About 1 hr to fix

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

    protected void mapChildren(DesktopCtrl desktopCtrl, List<String> uuids, List<String[]> idmap, List<Object[]> evtmap,
            Component comp) {
        for (Component p = comp.getFirstChild(); p != null; p = p.getNextSibling()) {
            if (p instanceof StubsComponent) {
                final String[] kiduuids = ((StubsComponent) p)._uuids;
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/sys/StubsComponent.java - About 1 hr to fix

    Avoid deeply nested control flow statements.
    Open

                            for (Object[] evtinf : kidevts)
                                evtmap.add(evtinf);
    Severity: Major
    Found in zk/src/main/java/org/zkoss/zk/ui/sys/StubsComponent.java - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if (desktopCtrl != null)
                                  desktopCtrl.mapComponent(uuid, this);
      Severity: Major
      Found in zk/src/main/java/org/zkoss/zk/ui/sys/StubsComponent.java - About 45 mins to fix

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

            protected void mapChildren(DesktopCtrl desktopCtrl, List<String> uuids, List<String[]> idmap, List<Object[]> evtmap,
                    Component comp) {
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/sys/StubsComponent.java - About 35 mins to fix

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

              public String getId(String uuid) {
                  if (_idmap != null)
                      for (String[] idinf : _idmap)
                          if (uuid.equals(idinf[0]))
                              return idinf[1];
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/ui/sys/StubsComponent.java - About 35 mins to fix

          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