the-allanc/pyinthesky

View on GitHub

Showing 15 of 25 total issues

Function parse_service_description has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

def parse_service_description(etree):
    from functools import partial
    from .xmlutils import nstag
    tag = partial(nstag, etree)

Severity: Minor
Found in pyinthesky/miniupnp.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 locate_by_ssdp has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

def locate_by_ssdp(service_types=None, host=None, timeout=5):
    from greyupnp.ssdp import search as ssdp_search

    if service_types is None:
        from pyinthesky import SERVICE_TYPES
Severity: Minor
Found in pyinthesky/base.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 locate_by_resource has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

def locate_by_resource(host, port=None, timeout=5):
    from .transport import Transport
    t = Transport(host, port, default_timeout=timeout)

    # How many services do we need to find?
Severity: Minor
Found in pyinthesky/base.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 bind_service_methods has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def bind_service_methods(target, services=None, bind_to_class=False):
    if services is None:
        services = [target]

    from pyinthesky import meta
Severity: Minor
Found in pyinthesky/methods.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 invoke has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def invoke(self, action_name, *args, **kwargs):

        from pyinthesky import minisoap, miniupnp, utils, xmlutils

        # Find the action definition and get the argument order.
Severity: Minor
Found in pyinthesky/base.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 treat_attributes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def treat_attributes(attrdict):
    res = {}
    for key, value in attrdict.items():

        # Drop X_ prefix.
Severity: Minor
Found in pyinthesky/main.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 method_sig_wrapper has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def method_sig_wrapper(target, name, varnames, defaults=None,
    make_method=False):

    # First of all, defaults will need to be a tuple rather than a
    # dictionary.
Severity: Minor
Found in pyinthesky/methods.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 create_validator has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def create_validator(objdesc, varname):
    args, kw = [], {}

    from formencode import validators as validmod
    if objdesc.pytype is six.text_type:
Severity: Minor
Found in pyinthesky/validators.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 get_recordings has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def get_recordings(self, user_only=True):

        # Using Browse('BrowseDirectChildren', ObjectID=0), you can determine the valid
        # object ID's to use, which are:
        #   3 - "pvr"
Severity: Minor
Found in pyinthesky/main.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 a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, host=None, port=None, root=None, fixed_root=False, default_timeout=10):
        if root and host:
            raise ValueError('cannot specify root as well as host')
        if root and '://' not in root:
            err = 'root must include protocol - e.g. "http://host:port/", not "%r"'
Severity: Minor
Found in pyinthesky/transport.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 soap_request has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def soap_request(self, location, schema, method, soapbody,
Severity: Minor
Found in pyinthesky/transport.py - About 45 mins to fix

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

    def simple_elements_dict(node):
        d = {}
        for attrname, attrvalue in node.items():
            d[attrname] = attrvalue
        for childnode in list(node):
    Severity: Minor
    Found in pyinthesky/xmlutils.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 __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, host=None, port=None, root=None, fixed_root=False, default_timeout=10):
    Severity: Minor
    Found in pyinthesky/transport.py - About 35 mins to fix

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

      def method_sig_wrapper(target, name, varnames, defaults=None,
      Severity: Minor
      Found in pyinthesky/methods.py - About 35 mins to fix

        Avoid too many return statements within this function.
        Open

            return UPnPError(code, desc)
        Severity: Major
        Found in pyinthesky/miniupnp.py - About 30 mins to fix
          Severity
          Category
          Status
          Source
          Language