Showing 8 of 8 total issues
Function heartbeat_loop
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def heartbeat_loop(client, bucket_id, poll_time, strategy, exclude_title=False):
while True:
if os.getppid() == 1:
logger.info("window-watcher stopped because parent process died")
break
- 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
Function get_window_name
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def get_window_name(window: Window) -> str:
"""After some annoying debugging I resorted to pretty much copying selfspy.
Source: https://github.com/gurgeh/selfspy/blob/8a34597f81000b3a1be12f8cde092a40604e49cf/selfspy/sniff_x.py#L165"""
try:
d = window.get_full_property(NET_WM_NAME, UTF8_STRING)
- 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
Function main
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def main():
args = parse_args()
if sys.platform.startswith("linux") and (
"DISPLAY" not in os.environ or not os.environ["DISPLAY"]
- 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
Function get_window_class
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_window_class(window: Window) -> str:
cls = None
try:
cls = window.get_wm_class()
- 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
Function heartbeat_loop
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def heartbeat_loop(client, bucket_id, poll_time, strategy, exclude_title=False):
Avoid too many return
statements within this function. Open
return d.value.encode("utf8").decode("utf8", "ignore")
Function get_active_window_id
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_active_window_id():
lines = xprop_root().split("\n")
match="_NET_ACTIVE_WINDOW(WINDOW)"
result = None
for line in lines:
- 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
Function get_current_window
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_current_window(strategy: Optional[str] = None) -> Optional[dict]:
"""
:raises FatalError: if a fatal error occurs (e.g. unsupported platform, X server closed)
"""
- 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"