localstack/localstack

View on GitHub
localstack-core/localstack/aws/protocol/parser.py

Summary

Maintainability
F
3 days
Test Coverage

File parser.py has 913 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
Request parsers for the different AWS service protocols.

The module contains classes that take an HTTP request to a service, and
given an operation model, parse the HTTP request according to the
Severity: Major
Found in localstack-core/localstack/aws/protocol/parser.py - About 2 days to fix

    Function _parse_shape has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        def _parse_shape(
            self, request: Request, shape: Shape, node: Any, uri_params: Mapping[str, Any] = None
        ) -> Any:
            """
            Main parsing method which dynamically calls the parsing function for the specific shape.
    Severity: Minor
    Found in localstack-core/localstack/aws/protocol/parser.py - About 3 hrs 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 _process_member has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def _process_member(
    Severity: Minor
    Found in localstack-core/localstack/aws/protocol/parser.py - About 45 mins to fix

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

          def _parse_payload(
      Severity: Minor
      Found in localstack-core/localstack/aws/protocol/parser.py - About 45 mins to fix

        Consider simplifying this complex logical expression.
        Open

                if (
                    shape is not None
                    and uri_params is not None
                    and shape.serialization.get("location") == "uri"
                    and shape.serialization.get("name") == "Key"
        Severity: Major
        Found in localstack-core/localstack/aws/protocol/parser.py - About 40 mins to fix

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

              def _parse_shape(
          Severity: Minor
          Found in localstack-core/localstack/aws/protocol/parser.py - About 35 mins to fix

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

                def _parse_map(
            Severity: Minor
            Found in localstack-core/localstack/aws/protocol/parser.py - About 35 mins to fix

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

                  def _parse_integer(self, _, shape, node: str, ___) -> int | None:
              Severity: Minor
              Found in localstack-core/localstack/aws/protocol/parser.py - About 35 mins to fix

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

                    def _parse_structure(
                Severity: Minor
                Found in localstack-core/localstack/aws/protocol/parser.py - About 35 mins to fix

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

                      def _get_text_content(
                  Severity: Minor
                  Found in localstack-core/localstack/aws/protocol/parser.py - About 35 mins to fix

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

                        def _parse_map(
                    Severity: Minor
                    Found in localstack-core/localstack/aws/protocol/parser.py - About 35 mins to fix

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

                          def _parse_structure(
                      Severity: Minor
                      Found in localstack-core/localstack/aws/protocol/parser.py - About 35 mins to fix

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

                            def _parse_boolean(
                        Severity: Minor
                        Found in localstack-core/localstack/aws/protocol/parser.py - About 35 mins to fix

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

                              def _parse_list(
                          Severity: Minor
                          Found in localstack-core/localstack/aws/protocol/parser.py - About 35 mins to fix

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

                                def _parse_list(
                            Severity: Minor
                            Found in localstack-core/localstack/aws/protocol/parser.py - About 35 mins to fix

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

                                  def _parse_blob(
                              Severity: Minor
                              Found in localstack-core/localstack/aws/protocol/parser.py - About 35 mins to fix

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

                                    def _parse_map(
                                Severity: Minor
                                Found in localstack-core/localstack/aws/protocol/parser.py - About 35 mins to fix

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

                                      def _parse_structure(
                                  Severity: Minor
                                  Found in localstack-core/localstack/aws/protocol/parser.py - About 35 mins to fix

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

                                    def _text_content(func):
                                        """
                                        This decorator hides the difference between an XML node with text or a plain string.
                                        It's used to ensure that scalar processing operates only on text strings, which
                                        allows the same scalar handlers to be used for XML nodes from the body, HTTP headers,
                                    Severity: Minor
                                    Found in localstack-core/localstack/aws/protocol/parser.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

                                    There are no issues that match your filters.

                                    Category
                                    Status