rohanpm/more-executors

View on GitHub

Showing 17 of 159 total issues

File retry.py has 386 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from concurrent.futures import Executor
from threading import RLock, Thread
import logging
import weakref

Severity: Minor
Found in more_executors/_impl/retry.py - About 5 hrs to fix

    ProxyFuture has 36 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ProxyFuture(MapFuture):
        # A future which proxies many calls through to the underlying object.
        def __init__(self, delegate, timeout):
            self.__timeout = timeout
            super(ProxyFuture, self).__init__(delegate)
    Severity: Minor
    Found in more_executors/_impl/futures/proxy.py - About 4 hrs to fix

      Function _submit_loop has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def _submit_loop(executor_ref):
          # Runs in a separate thread continuously submitting to the delegate
          # executor until no jobs are ready, or waiting until next job is ready
          while True:
              executor = executor_ref()
      Severity: Minor
      Found in more_executors/_impl/retry.py - 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

      Function __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(
      Severity: Major
      Found in more_executors/_impl/retry.py - About 1 hr to fix

        Function _get_next_job has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def _get_next_job(self):
                # Find and return the next job to be handled, if any.
                # This means a job with when < now, or with stop_retry == True,
                # or if there's none, then the job with the minimum value of when.
                min_job = None
        Severity: Minor
        Found in more_executors/_impl/retry.py - 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

        Function _poll_loop has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def _poll_loop(executor_ref):
            while True:
                executor = executor_ref()
                if not executor:
                    break
        Severity: Minor
        Found in more_executors/_impl/poll.py - About 55 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

        Function _submit_loop_iter has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def _submit_loop_iter(executor):
            if not executor:
                return
        
            if executor._shutdown.is_shutdown or is_shutdown():
        Severity: Minor
        Found in more_executors/_impl/throttle.py - About 55 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

        Function handle_done has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def handle_done(self, index, f):
                set_result = False
                set_exception = False
                cancel = False
        
        
        Severity: Minor
        Found in more_executors/_impl/futures/zip.py - About 55 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

        Function record_done has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def record_done(f, started_when, time, inprogress, cancelled, failed):
        Severity: Minor
        Found in more_executors/_impl/metrics/__init__.py - About 45 mins to fix

          Function _delegate_resolved has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def _delegate_resolved(self, delegate):
                  assert delegate is self._delegate, "BUG: called with %s, expected %s" % (
                      delegate,
                      self._delegate,
                  )
          Severity: Minor
          Found in more_executors/_impl/map.py - About 45 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

          Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(
          Severity: Minor
          Found in more_executors/_impl/poll.py - About 45 mins to fix

            Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(self, delegate, count, logger=None, name="default", block=False):
            Severity: Minor
            Found in more_executors/_impl/throttle.py - About 35 mins to fix

              Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(
              Severity: Minor
              Found in more_executors/_impl/retry.py - About 35 mins to fix

                Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def __init__(self, delegate, fn=None, logger=None, name="default", **kwargs):
                Severity: Minor
                Found in more_executors/_impl/map.py - About 35 mins to fix

                  Function get_state_update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def get_state_update(self, f):
                          set_result = False
                          set_exception = False
                          cancel_futures = set()
                  
                  
                  Severity: Minor
                  Found in more_executors/_impl/futures/bool.py - 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

                  Function _cancel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _cancel(self, future):
                          found_job = None
                  
                          with self._lock:
                              for idx, job in enumerate(self._jobs):
                  Severity: Minor
                  Found in more_executors/_impl/retry.py - 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

                  Function _wrapped_f_apply has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def _wrapped_f_apply(future_fn, future_args):
                      if not future_args:
                          return wrap(future_fn).with_map(lambda fn: fn())()
                  
                      future_key_and_x = future_args[0]
                  Severity: Minor
                  Found in more_executors/_impl/futures/apply.py - About 25 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

                  Severity
                  Category
                  Status
                  Source
                  Language