async-worker/async-worker

View on GitHub

Showing 17 of 17 total issues

File queue.py has 347 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import abc
import asyncio
import json
import logging
import traceback
Severity: Minor
Found in asyncworker/easyqueue/queue.py - About 4 hrs to fix

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

        def __init__(
    Severity: Major
    Found in asyncworker/easyqueue/queue.py - About 1 hr to fix

      Function _ensure_conn_is_ready has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      def _ensure_conn_is_ready(conn_type: ConnType):
          def _ensure_connected(coro: Callable[..., Coroutine]):
              @wraps(coro)
              async def wrapper(self: "JsonQueue", *args, **kwargs):
                  conn = self.conn_types[conn_type]
      Severity: Minor
      Found in asyncworker/easyqueue/queue.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 _install_request_parser_annotation has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def _install_request_parser_annotation(f, base_generic_type: Type):
          handler_type_hints = get_handler_original_typehints(f)
          path_params: List[RequestParserAnnotationSpec] = []
      
          for name, _type in handler_type_hints.items():
      Severity: Minor
      Found in asyncworker/http/entrypoints.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 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(
      Severity: Major
      Found in asyncworker/easyqueue/connection.py - About 1 hr to fix

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

            def __init__(
        Severity: Major
        Found in asyncworker/consumer.py - About 1 hr to fix

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

              def __init__(
          Severity: Major
          Found in asyncworker/easyqueue/message.py - About 1 hr to fix

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

                def route(
                    self,
                    routes: Iterable[str],
                    type: RouteTypes,
                    options: Optional[dict] = None,
            Severity: Minor
            Found in asyncworker/app.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 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(
            Severity: Major
            Found in asyncworker/easyqueue/queue.py - About 1 hr to fix

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

                  def route(
              Severity: Minor
              Found in asyncworker/app.py - About 35 mins to fix

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

                def _register_amqp_handler(
                Severity: Minor
                Found in asyncworker/rabbitmq/entrypoints.py - About 35 mins to fix

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

                      def get_connection_for_route(self, route_info: Route):
                          route_connection = route_info.connection
                          if route_connection is None:
                              route_connection = route_info.options.get("connection")
                  
                  
                  Severity: Minor
                  Found in asyncworker/app.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 get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def get(
                          self, _type: Type, param_name: Optional[str] = None, type_args=None
                      ) -> Optional[Any]:
                          origin = get_origin(_type) or _type
                          _type_args = type_args or get_args(_type)
                  Severity: Minor
                  Found in asyncworker/types/registry.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 __eq__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def __eq__(self, other):
                          if not isinstance(other, self.__class__):
                              return False
                          for attr in self.__slots__:
                              if attr.startswith("__"):
                  Severity: Minor
                  Found in asyncworker/easyqueue/message.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 parse_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def parse_path(handler):
                      """
                      Decorator que permite receber dinamicamente parametros do Request Path
                      Basta que o nome do parametro na assinatura do handler seja igual ao nome do parametro
                      declarado no Path HTTP.
                  Severity: Minor
                  Found in asyncworker/http/decorators.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 aiohttp_routes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def aiohttp_routes(self) -> Iterable[RouteDef]:
                          for route in self.routes:
                              for method in self.methods:
                                  kwargs = {"allow_head": False} if method == "GET" else {}
                                  yield RouteDef(
                  Severity: Minor
                  Found in asyncworker/routes.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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def __init__(
                          self,
                          host: str,
                          username: str,
                          password: str,
                  Severity: Minor
                  Found in asyncworker/easyqueue/queue.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