ivanprjcts/sdklib

View on GitHub

Showing 44 of 92 total issues

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

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

    def parse(xml_input, encoding=None, expat=expat, process_namespaces=False,
              namespace_separator=':', **kwargs):
        """Parse the given XML input and convert it into a dictionary.
    
        `xml_input` can either be a `string` or a file-like object.
    Severity: Minor
    Found in sdklib/util/xmltodict.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

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

    def get_renderer(name=None, mime_type=None):
        if name == 'json' or mime_type == JSONRenderer.DEFAULT_CONTENT_TYPE:
            return JSONRenderer()
        elif name == 'form' or mime_type == FormRenderer.DEFAULT_CONTENT_TYPE:
            return FormRenderer()
    Severity: Minor
    Found in sdklib/http/renderers.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

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

    def timeout(milliseconds=10000, silent=False):
        def wrap_function(func):
            @wraps(func)
            def __wrapper(*args, **kwargs):
                try:
    Severity: Minor
    Found in sdklib/util/times.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