Ananto30/zero

View on GitHub

Showing 16 of 16 total issues

File client.py has 291 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import asyncio
import logging
import threading
from typing import Any, Dict, Optional, Tuple, Type, TypeVar, Union

Severity: Minor
Found in zero/client_server/client.py - About 3 hrs to fix

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

        def handle_msg(self, rpc, msg):
            if rpc == "get_rpc_contract":
                return self.generate_rpc_contract(msg)
    
            if rpc == "connect":
    Severity: Minor
    Found in zero/client_server/worker.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 generate_client_code_and_save has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def generate_client_code_and_save(host, port, directory, overwrite_dir=False):
        zero_client = ZeroClient(host, port)
        code = zero_client.call("get_rpc_contract", [host, port])
    
        if isinstance(code, dict) and "__zerror__failed_to_generate_client_code" in code:
    Severity: Minor
    Found in zero/generate_client.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, id, items, created_by, created_at, status, updated_at=None):
    Severity: Minor
    Found in benchmarks/local/zero/shared.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                      if not data:
                          break
                      data = msgpack.unpackb(data)
      Severity: Major
      Found in benchmarks/others/lame_socket_server.py - About 45 mins to fix

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

            def __init__(self, id, items, created_by, created_at, status, updated_at=None):
        Severity: Minor
        Found in benchmarks/dockerize/aiozmq/shared.py - About 45 mins to fix

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

              def __init__(self, id, items, created_by, created_at, status, updated_at=None):
          Severity: Minor
          Found in benchmarks/dockerize/fast_api/shared.py - About 45 mins to fix

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

                def __init__(self, id, items, created_by, created_at, status, updated_at=None):
            Severity: Minor
            Found in benchmarks/dockerize/zero/shared.py - About 45 mins to fix

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

                  def __init__(self, id, items, created_by, created_at, status, updated_at=None):
              Severity: Minor
              Found in benchmarks/dockerize/sanic/shared.py - About 45 mins to fix

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

                    def __init__(self, id, items, created_by, created_at, status, updated_at=None):
                Severity: Minor
                Found in benchmarks/dockerize/aiohttp/shared.py - About 45 mins to fix

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

                      def spawn_worker(
                  Severity: Minor
                  Found in zero/client_server/worker.py - About 45 mins to fix

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

                        def __init__(
                    Severity: Minor
                    Found in zero/client_server/worker.py - About 35 mins to fix

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

                          def run(self):
                              processes = []
                              try:
                                  processes = [
                                      Process(
                      Severity: Minor
                      Found in zero/pubsub/subscriber.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 verify_incoming_rpc_call_input_type has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def verify_incoming_rpc_call_input_type(
                          msg, rpc_method: str, rpc_input_type_map: dict
                      ):  # pragma: no cover
                          input_type = rpc_input_type_map[rpc_method]
                          if input_type is None:
                      Severity: Minor
                      Found in zero/utils/type_util.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 call has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def call(
                              self,
                              rpc_func_name: str,
                              msg: Union[int, float, str, dict, list, tuple, None],
                              timeout: Optional[int] = None,
                      Severity: Minor
                      Found in zero/client_server/client.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 verify_function_input_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def verify_function_input_type(func: Callable):
                          input_type = get_function_input_class(func)
                          if input_type in allowed_types:
                              return
                      
                      
                      Severity: Minor
                      Found in zero/utils/type_util.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