aequitas/python-rflink

View on GitHub
rflinkproxy/__main__.py

Summary

Maintainability
B
4 hrs
Test Coverage

File __main__.py has 263 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Command line interface for rflink proxy.

Usage:
  rflinkproxy [-v | -vv] [options]
  rflinkproxy (-h | --help)
Severity: Minor
Found in rflinkproxy/__main__.py - About 2 hrs to fix

    Function decode_tx_packet has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def decode_tx_packet(packet: str) -> dict:
        """Break packet down into primitives, and do basic interpretation.
    
        >>> decode_packet('20;06;Kaku;ID=41;SWITCH=1;CMD=ON;') == {
        ...     'node': 'gateway',
    Severity: Minor
    Found in rflinkproxy/__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 main has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def main(argv=sys.argv[1:], loop=None):
        """Parse argument and setup main program loop."""
        args = docopt(
            __doc__, argv=argv, version=pkg_resources.require("rflink")[0].version
        )
    Severity: Minor
    Found in rflinkproxy/__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 handle_raw_packet has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def handle_raw_packet(self, raw_packet):
            """Parse raw packet string into packet dict."""
            log.debug("got packet: %s", raw_packet)
            packet = None
            try:
    Severity: Minor
    Found in rflinkproxy/__main__.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

    There are no issues that match your filters.

    Category
    Status