EventGhost/EventGhost

View on GitHub
eg/LoopbackSocket.py

Summary

Maintainability
C
1 day
Test Coverage

Function run has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    def run(self):
        atexit.register(self.Stop)

        def start_sock():
            try:
Severity: Minor
Found in eg/LoopbackSocket.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 run has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def run(self):
        try:
            self.sock.settimeout(1)
            data = ''
            self.sock.sendall('?\r')
Severity: Minor
Found in eg/LoopbackSocket.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 LoopbackSocket.py has 262 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import threading
import socket
import traceback
import sys
import atexit
Severity: Minor
Found in eg/LoopbackSocket.py - About 2 hrs to fix

    Function process_data has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def process_data(command):
        try:
            command, data = command.split(',', 1)
        except ValueError:
            data = '()'
    Severity: Minor
    Found in eg/LoopbackSocket.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 send_message has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def send_message(message):
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        sock.settimeout(2.0)
        sys.stderr._displayMessage = False
    Severity: Minor
    Found in eg/LoopbackSocket.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

    There are no issues that match your filters.

    Category
    Status