mardiros/blacksmith

View on GitHub

Showing 34 of 36 total issues

File route_proxy.py has 374 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from typing import Any, Dict, Generic, List, Mapping, Optional, Tuple, Type, Union

try:
    from types import UnionType  # type: ignore
except ImportError:  # coverage: ignore
Severity: Minor
Found in src/blacksmith/service/_async/route_proxy.py - About 5 hrs to fix

    File route_proxy.py has 360 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from typing import Any, Dict, Generic, List, Mapping, Optional, Tuple, Type, Union
    
    try:
        from types import UnionType  # type: ignore
    except ImportError:  # coverage: ignore
    Severity: Minor
    Found in src/blacksmith/service/_sync/route_proxy.py - About 4 hrs to fix

      File params.py has 317 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import abc
      import warnings
      from dataclasses import dataclass
      from functools import partial
      from typing import (
      Severity: Minor
      Found in src/blacksmith/domain/model/params.py - About 3 hrs to fix

        ResponseBox has 23 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class ResponseBox(Generic[TResponse, TError_co]):
            """
            Wrap a HTTP response and deserialize it.
        
            ::
        Severity: Minor
        Found in src/blacksmith/domain/model/params.py - About 2 hrs to fix

          SyncRouteProxy has 22 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class SyncRouteProxy(Generic[TCollectionResponse, TResponse, TError_co]):
              """Proxy from resource to its associate routes."""
          
              client_name: ClientName
              name: ResourceName
          Severity: Minor
          Found in src/blacksmith/service/_sync/route_proxy.py - About 2 hrs to fix

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

            def serialize_response(resp: HTTPRawResponse) -> HTTPResponse:
                """
                Deserialize an http response to the http intermediate representation that will
                become the pydantic based response.
                Basically it parse json bytes a a python structure. But this function is here
            Severity: Minor
            Found in src/blacksmith/service/http_body_serializer.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 src/blacksmith/service/_sync/route_proxy.py - About 1 hr to fix

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

              def register(
              Severity: Major
              Found in src/blacksmith/domain/registry.py - About 1 hr to fix

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

                    def register(
                Severity: Major
                Found in src/blacksmith/domain/registry.py - About 1 hr to fix

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

                      def __init__(
                  Severity: Major
                  Found in src/blacksmith/service/_async/route_proxy.py - About 1 hr to fix

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

                        def __init__(
                    Severity: Major
                    Found in src/blacksmith/service/_async/client.py - About 1 hr to fix

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

                          def __init__(
                      Severity: Major
                      Found in src/blacksmith/service/_sync/client.py - About 1 hr to fix

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

                            def __init__(
                        Severity: Major
                        Found in src/blacksmith/service/_async/client.py - About 1 hr to fix

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

                              def __init__(
                          Severity: Major
                          Found in src/blacksmith/service/_sync/client.py - About 1 hr to fix

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

                            def build_request(typ: Type[Any], params: Mapping[str, Any]) -> Request:
                                if is_union(typ):
                                    err: Optional[Exception] = None
                                    for t in typ.__args__:  # type: ignore
                                        try:
                            Severity: Minor
                            Found in src/blacksmith/service/_async/route_proxy.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 build_request has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def build_request(typ: Type[Any], params: Mapping[str, Any]) -> Request:
                                if is_union(typ):
                                    err: Optional[Exception] = None
                                    for t in typ.__args__:  # type: ignore
                                        try:
                            Severity: Minor
                            Found in src/blacksmith/service/_sync/route_proxy.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 parse_header_links has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def parse_header_links(value: str) -> List[Dict[str, str]]:
                                """
                                Returns a list of parsed link headers, for more info see:
                                https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link
                            
                            
                            Severity: Minor
                            Found in src/blacksmith/domain/model/http.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 7 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def __init__(
                            Severity: Major
                            Found in src/blacksmith/sd/_async/adapters/consul.py - About 50 mins to fix

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

                                  def __init__(
                              Severity: Major
                              Found in src/blacksmith/domain/model/params.py - About 50 mins to fix

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

                                    def __init__(
                                Severity: Major
                                Found in src/blacksmith/sd/_sync/adapters/consul.py - About 50 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language