Showing 3 of 4 total issues

File robot.py has 289 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
Robot class.

It allows interactions with the robot cloud api
"""
Severity: Minor
Found in irbt/robot.py - About 2 hrs to fix

    Function get has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

            def get(self, *a, params=None, as_json=True):
                """
                HTTP GET.
    
                Authenticated GET method
    Severity: Minor
    Found in irbt/cloud.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 _make_payload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def _make_payload(self, room_ids, cmd):
            payload = {
                'state': 'desired',
                'command': cmd,
                'initiator': 'rmtApp',
    Severity: Minor
    Found in irbt/robot.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