Showing 5 of 22 total issues
Fritzhome
has 55 functions (exceeds 30 allowed). Consider refactoring. Open
Open
class Fritzhome(object):
"""Fritzhome object to communicate with the device."""
_sid = None
_session = None
File fritzhome.py
has 364 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
"""The main fritzhome handling class."""
# -*- coding: utf-8 -*-
from __future__ import print_function
Function list_all
has a Cognitive Complexity of 28 (exceeds 13 allowed). Consider refactoring. Open
Open
def list_all(fritz, args):
"""Command that prints all device information."""
devices = fritz.get_devices()
for device in devices:
- Read upRead up
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
Open
#!/usr/bin/env python
"""A simple CLI tool."""
# -*- coding: utf-8 -*-
from __future__ import print_function
Function main
has 74 lines of code (exceeds 45 allowed). Consider refactoring. Open
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"