ivanprjcts/sdklib

View on GitHub

Showing 44 of 92 total issues

File base.py has 439 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import copy
import urllib3
import ssl
import os

Severity: Minor
Found in sdklib/http/base.py - About 6 hrs to fix

    Function _emit has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

    def _emit(key, value, content_handler,
              attr_prefix='@',
              cdata_key='#text',
              depth=0,
              preprocessor=None,
    Severity: Minor
    Found in sdklib/util/xmltodict.py - About 5 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

    File xmltodict.py has 389 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #!/usr/bin/env python
    "Makes working with XML feel like you are working with JSON"
    
    try:
        from defusedexpat import pyexpat as expat
    Severity: Minor
    Found in sdklib/util/xmltodict.py - About 5 hrs to fix

      Function encode_params has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

          def encode_params(self, data=None, **kwargs):
              """
              Encode parameters in a piece of data.
              Will successfully encode parameters when passed as a dict or a list of
              2-tuples. Order is retained if data is a list of 2-tuples but arbitrary
      Severity: Minor
      Found in sdklib/http/renderers.py - About 4 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 encode_params has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

          def encode_params(self, data=None, **kwargs):
              """
              Build the body for a text/plain request.
              Will successfully encode parameters when passed as a dict or a list of
              2-tuples. Order is retained if data is a list of 2-tuples but arbitrary
      Severity: Minor
      Found in sdklib/http/renderers.py - About 4 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 endElement has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          def endElement(self, full_name):
              name = self._build_name(full_name)
              if len(self.path) == self.item_depth:
                  item = self.item
                  if item is None:
      Severity: Minor
      Found in sdklib/util/xmltodict.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 encode_params has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          def encode_params(self, data=None, files=None, **kwargs):
              """
              Build the body for a multipart/form-data request.
              Will successfully encode files when passed as a dict or a list of
              tuples. Order is retained if data is a list of tuples but arbitrary
      Severity: Minor
      Found in sdklib/http/renderers.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

      File renderers.py has 294 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import json
      try:
          from exceptions import BaseException
      except Exception:
          pass
      Severity: Minor
      Found in sdklib/http/renderers.py - About 3 hrs to fix

        HttpRequestContext has 26 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class HttpRequestContext(object):
            """
            Context object used to save http request parameters.
            """
        
        
        Severity: Minor
        Found in sdklib/http/base.py - About 3 hrs to fix

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

              def __init__(
          Severity: Major
          Found in sdklib/http/base.py - About 2 hrs to fix

            Function startElement has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                def startElement(self, full_name, attrs):
                    name = self._build_name(full_name)
                    attrs = self._attrs_to_dict(attrs)
                    self.path.append((name, attrs or None))
                    if len(self.path) > self.item_depth:
            Severity: Minor
            Found in sdklib/util/xmltodict.py - About 2 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 __init__ has 13 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(self,
            Severity: Major
            Found in sdklib/util/xmltodict.py - About 1 hr to fix

              Function _parse_params_as_tuple_list has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

              def _parse_params_as_tuple_list(params, separate_list_elements):
                  to_return = []
                  for elem in params:
                      if params[elem] is not None:
                          if isinstance(params[elem], list) and separate_list_elements:
              Severity: Minor
              Found in sdklib/util/parser.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 _emit has 11 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def _emit(key, value, content_handler,
              Severity: Major
              Found in sdklib/util/xmltodict.py - About 1 hr to fix

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

                def to_key_val_dict(values):
                    """
                    Take an object and test to see if it can be represented as a
                    dictionary. If it can be, return a dict, e.g.,
                    ::
                Severity: Minor
                Found in sdklib/util/structures.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 push_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def push_data(self, item, key, data):
                        if self.postprocessor is not None:
                            result = self.postprocessor(self.path, key, data)
                            if result is None:
                                return item
                Severity: Minor
                Found in sdklib/util/xmltodict.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_url_path has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                def generate_url_path(
                        url_path_format, prefix=None, format_suffix=None, allow_key_errors=True, **kwargs
                ):
                    prefix = prefix or ''
                    suffix = ensure_url_path_format_suffix_starts_with_dot(format_suffix)
                Severity: Minor
                Found in sdklib/http/base.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 _http_request has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def _http_request(
                Severity: Major
                Found in sdklib/http/base.py - About 50 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 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
                    Severity
                    Category
                    Status
                    Source
                    Language