Function popup
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def popup(self, widget):
"""Create Popup that allows the user to control their displays in one
of three ways: launch arandr, select a pre-set screenlayout, toggle a
display.
"""
- Read upRead up
- Create a ticketCreate a ticket
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_layouts
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _get_layouts():
"""Loads and parses the arandr screen layout scripts."""
layouts = {}
try:
for filename in os.listdir(__screenlayout_dir__):
- Read upRead up
- Create a ticketCreate a ticket
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
Avoid deeply nested control flow statements. Open
if "xrandr" not in s_line:
continue
displays_in_file = Module._parse_layout(line)
- Create a ticketCreate a ticket
Function _prune_layouts
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _prune_layouts(layouts, displays):
"""Return a list of layouts whose displays are actually connected."""
available = []
for layout, needs in layouts.items():
still_valid = True
- Read upRead up
- Create a ticketCreate a ticket
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"