zk/src/main/java/org/zkoss/zk/ui/impl/EventProcessingThreadImpl.java

Summary

Maintainability
D
2 days
Test Coverage

Method run has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    public void run() {
        ++_nThd;
        try {
            while (_ceased == null) {
                if (!isIdle()) {
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/impl/EventProcessingThreadImpl.java - About 5 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

File EventProcessingThreadImpl.java has 345 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* EventProcessingThreadImpl.java

    Purpose:
        
    Description:
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/impl/EventProcessingThreadImpl.java - About 4 hrs to fix

    Method processEvent has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public boolean processEvent(Desktop desktop, Component comp, Event event) {
            if (Thread.currentThread() instanceof EventProcessingThreadImpl)
                throw new IllegalStateException("processEvent cannot be called in an event thread");
            if (_ceased != null)
                throw new InternalError("The event thread has beeing stopped. Cause: " + _ceased);
    Severity: Minor
    Found in zk/src/main/java/org/zkoss/zk/ui/impl/EventProcessingThreadImpl.java - About 2 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

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

    public class EventProcessingThreadImpl extends Thread implements EventProcessingThread {
        private static final Logger log = LoggerFactory.getLogger(EventProcessingThreadImpl.class);
    
        /** The processor. */
        private EventProcessor _proc;
    Severity: Minor
    Found in zk/src/main/java/org/zkoss/zk/ui/impl/EventProcessingThreadImpl.java - About 2 hrs to fix

      Method run has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public void run() {
              ++_nThd;
              try {
                  while (_ceased == null) {
                      if (!isIdle()) {
      Severity: Major
      Found in zk/src/main/java/org/zkoss/zk/ui/impl/EventProcessingThreadImpl.java - About 2 hrs to fix

        Method doSuspend0 has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private void doSuspend0(Object mutex) throws InterruptedException {
                //        if (log.finerable()) log.finer("Suspend event processing; "+_proc);
                if (mutex == null)
                    throw new IllegalArgumentException("null mutex");
                if (isIdle())
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/impl/EventProcessingThreadImpl.java - About 2 hrs to fix

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

              public boolean processEvent(Desktop desktop, Component comp, Event event) {
                  if (Thread.currentThread() instanceof EventProcessingThreadImpl)
                      throw new IllegalStateException("processEvent cannot be called in an event thread");
                  if (_ceased != null)
                      throw new InternalError("The event thread has beeing stopped. Cause: " + _ceased);

            Method doSuspend0 has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                private void doSuspend0(Object mutex) throws InterruptedException {
                    //        if (log.finerable()) log.finer("Suspend event processing; "+_proc);
                    if (mutex == null)
                        throw new IllegalArgumentException("null mutex");
                    if (isIdle())

            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