viatoriche/microservices

View on GitHub

Showing 34 of 52 total issues

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

def tornado_combiner(configs, use_gevent=False, start=True, monkey_patch=None,
                     Container=None, Server=None, threadpool=None):  # pragma: no cover
    """Combine servers in one tornado event loop process

    :param configs: [
Severity: Minor
Found in microservices/http/runners.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 tornado_combiner has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def tornado_combiner(configs, use_gevent=False, start=True, monkey_patch=None,
Severity: Major
Found in microservices/http/runners.py - About 50 mins to fix

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

        def __init__(self, name, handler, logger, autoack=True,
    Severity: Major
    Found in microservices/queues/service.py - About 50 mins to fix

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

          def add_queue_rule(self, handler, name, autoack=True, prefetch_size=0,
      Severity: Minor
      Found in microservices/queues/service.py - About 45 mins to fix

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

            def __init__(
        Severity: Minor
        Found in microservices/http/resources.py - About 35 mins to fix

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

              def queue(self, name, autoack=True, prefetch_size=0, prefetch_count=0,
          Severity: Minor
          Found in microservices/queues/service.py - About 35 mins to fix

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

                def url_for(self, resource='', query=None, params='', fragment='',
            Severity: Minor
            Found in microservices/http/client.py - About 35 mins to fix

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

              def gevent_run(app, monkey_patch=True, start=True, debug=False,
              Severity: Minor
              Found in microservices/queues/runners.py - About 35 mins to fix

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

                    def __call__(self, immediate=False, sleep=None):  # pragma: no cover
                        if use_gevent:
                            self._calls += 1
                            if self._calls >= self.max_calls or immediate:
                                self._calls = 0
                Severity: Minor
                Found in microservices/utils/__init__.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

                Avoid too many return statements within this function.
                Open

                    return url
                Severity: Major
                Found in microservices/http/helpers.py - About 30 mins to fix

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

                      def __init__(self, connection='amqp:///', logger=None, timeout=1, name=None,
                                   workers=None, pool_factory=ThreadPool, reconnect_timeout=1,
                                   reconnect_enable=True, workers_override_prefetch=True,
                                   immediate_connect=True):
                          """Initialization
                  Severity: Minor
                  Found in microservices/queues/service.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

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

                      def test_workers(self):
                          from microservices.queues.service import Microservice
                          from microservices.queues.client import Client
                  
                          microservice = Microservice('memory:///', timeout=0.01, workers=5)
                  Severity: Minor
                  Found in microservices/queues/test.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

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

                      def request(self, method, *resources, **kwargs):
                          method = method.upper()
                          response_key = kwargs.pop('response_key', None)
                          key = kwargs.pop('key', None)
                          if key is not None:
                  Severity: Minor
                  Found in microservices/http/client.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

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

                      def test_service(self):
                          from microservices.queues.service import Microservice
                          from microservices.queues.client import Client
                          from kombu.connection import Connection
                  
                  
                  Severity: Minor
                  Found in microservices/queues/test.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