hthiery/python-fritzhome

View on GitHub

Showing 5 of 22 total issues

Fritzhome has 55 functions (exceeds 30 allowed). Consider refactoring.
Open

class Fritzhome(object):
    """Fritzhome object to communicate with the device."""

    _sid = None
    _session = None
Severity: Major
Found in pyfritzhome/fritzhome.py - About 6 hrs to fix

    File fritzhome.py has 364 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """The main fritzhome handling class."""
    # -*- coding: utf-8 -*-
    
    from __future__ import print_function
    
    
    Severity: Minor
    Found in pyfritzhome/fritzhome.py - About 4 hrs to fix

      Function list_all has a Cognitive Complexity of 28 (exceeds 13 allowed). Consider refactoring.
      Open

      def list_all(fritz, args):
          """Command that prints all device information."""
          devices = fritz.get_devices()
      
          for device in devices:
      Severity: Minor
      Found in pyfritzhome/cli.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

      File cli.py has 269 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      #!/usr/bin/env python
      """A simple CLI tool."""
      # -*- coding: utf-8 -*-
      
      from __future__ import print_function
      Severity: Minor
      Found in pyfritzhome/cli.py - About 2 hrs to fix

        Function main has 74 lines of code (exceeds 45 allowed). Consider refactoring.
        Open

        def main(args=None):
            """Enter the main function of the CLI tool."""
            parser = argparse.ArgumentParser(description="Fritz!Box Smarthome CLI tool.")
            parser.add_argument(
                "-v", action="store_true", dest="verbose", help="be more verbose"
        Severity: Major
        Found in pyfritzhome/cli.py - About 2 hrs to fix
          Severity
          Category
          Status
          Source
          Language