ivanprjcts/sdklib

View on GitHub

Showing 44 of 92 total issues

Function _get_11paths_serialized_headers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def _get_11paths_serialized_headers(x_headers):
    """
    Prepares and returns a string ready to be signed from the 11-paths specific HTTP headers
    received.

Severity: Minor
Found in sdklib/http/authorization.py - About 45 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 put has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def put(
Severity: Minor
Found in sdklib/http/base.py - About 45 mins to fix

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

    def parse(xml_input, encoding=None, expat=expat, process_namespaces=False,
    Severity: Minor
    Found in sdklib/util/xmltodict.py - About 45 mins to fix

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

          def patch(
      Severity: Minor
      Found in sdklib/http/base.py - About 45 mins to fix

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

            def post(
        Severity: Minor
        Found in sdklib/http/base.py - About 45 mins to fix

          Function request_from_context has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def request_from_context(context):
              """
              Do http requests from context.
          
              :param context: request context.
          Severity: Minor
          Found in sdklib/http/base.py - About 45 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 generate_url has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def generate_url(scheme=None, host=None, port=None, path=None, query=None):
          Severity: Minor
          Found in sdklib/util/urls.py - About 35 mins to fix

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

                def __init__(self, headers=None, status=None, status_text=None, http_version=None, body=None):
            Severity: Minor
            Found in sdklib/http/response.py - About 35 mins to fix

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

              def log_print_request(method, url, query_params=None, headers=None, body=None):
              Severity: Minor
              Found in sdklib/util/logger.py - About 35 mins to fix

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

                def generate_url_path(
                Severity: Minor
                Found in sdklib/http/base.py - About 35 mins to fix

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

                  def unparse(input_dict, output=None, encoding='utf-8', full_document=True,
                  Severity: Minor
                  Found in sdklib/util/xmltodict.py - About 35 mins to fix

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

                    def to_key_val_list(value, sort=False, insensitive=False):
                        """
                        Take an object and test to see if it can be represented as a
                        dictionary. If it can be, return a list of tuples, e.g.,
                        ::
                    Severity: Minor
                    Found in sdklib/util/structures.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 apply_authentication has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def apply_authentication(self, context):
                            context.headers[X_11PATHS_DATE_HEADER_NAME] = self.utc or _get_utc()
                            if context.method == POST_METHOD or context.method == PUT_METHOD:
                                if CONTENT_TYPE_HEADER_NAME in context.headers and \
                                        context.headers[CONTENT_TYPE_HEADER_NAME].lower().startswith(
                    Severity: Minor
                    Found in sdklib/http/authorization.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 str(data).encode(charset) if charset else str(data),\
                    Severity: Major
                    Found in sdklib/http/renderers.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return data, self.content_type
                      Severity: Major
                      Found in sdklib/http/renderers.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return b'\n'.join(results), self.get_content_type(charset)
                        Severity: Major
                        Found in sdklib/http/renderers.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return b"\n".join(results), self.get_content_type(charset)
                          Severity: Major
                          Found in sdklib/http/renderers.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return urlencode(data, doseq=False), self.content_type
                            Severity: Major
                            Found in sdklib/http/renderers.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                          return '&'.join(results), self.content_type
                              Severity: Major
                              Found in sdklib/http/renderers.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                            return b'\n'.join(result), self.get_content_type(charset)
                                Severity: Major
                                Found in sdklib/http/renderers.py - About 30 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language