Showing 44 of 198 total issues
File util.py
has 736 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Helper functions and classes"""
__author__ = "Stephan Sokolow (deitarion/SSokolow)"
__license__ = "GNU GPL 2.0 or later"
File test_util.py
has 705 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
"""Tests for ``quicktile.util`` module"""
__author__ = "Stephan Sokolow (deitarion/SSokolow)"
__license__ = "GNU GPL 2.0 or later"
File commands.py
has 422 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Available window-management commands
.. todo:: Replace varargs with a dict so ``CommandCBWrapper`` can be strict.
"""
File wm.py
has 361 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Wrapper around libwnck for interacting with the window manager"""
__author__ = "Stephan Sokolow (deitarion/SSokolow)"
__license__ = "GNU GPL 2.0 or later"
Function gather_vars
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def gather_vars(frame_rec: inspect.FrameInfo,
local_vars: Dict[str, Any]) -> Dict[str, Any]:
"""Extract all the local variables from the given traceback frame using
:func:`lookup`.
- 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 load_config
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def load_config(path) -> ConfigParser:
"""Load the config file from the given path, applying fixes as needed.
If it does not exist, create it from the configuration defaults.
:param path: The path to load or initialize.
- 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 21 (exceeds 5 allowed). Consider refactoring. Open
def main() -> None:
"""setuptools-compatible entry point
:raises XInitError: Failed to connect to the X server.
- 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 gtkexcepthook.py
has 280 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python3
# pylint: disable=line-too-long
"""Graphical exception handler for PyGTK applications
Usage
TestRectangle
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class TestRectangle(unittest.TestCase): # pylint: disable=R0904
"""Tests for my custom `Rectangle` class"""
def setUp(self):
"""Implicitly test positional and keyword construction during setup"""
Rectangle
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Rectangle(_Rectangle):
"""A representation of a rectangle with some useful methods
Fundamentally, this is a named tuple of the form ``(x, y, width, height)``
with some extra methods and properties to make it more useful.
Function _trim_strut
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _trim_strut(self, strut: Tuple[Edge, Rectangle]) -> Rectangle:
"""Trim a strut rectangle to just the monitor it applies to
This is internal code used by :meth:`_update` but split out to manage
complexity and improve testability.
- 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 fmt_table
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def fmt_table(rows: Union[Dict, Iterable[List]],
headers: Sequence[str],
group_by: int = None,
) -> str:
"""Format a collection as a textual table.
- 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 add
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def add(self, name: str, *p_args: Any, **p_kwargs: Any
) -> Callable[[CommandCB], CommandCB]:
"""Decorator to wrap a function in boilerplate and add it to the
command registry under the given name.
- 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 __call__
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def __call__(self,
exctyp: Type[BaseException],
value: BaseException,
tback: TracebackType):
"""Custom :any:`sys.excepthook` callback which displays a GTK dialog"""
- 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 __new__
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
def __new__(cls, left=0, right=0, top=0, bottom=0, # pylint: disable=R0913
Function __new__
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def __new__(cls, x: int = None, y: int = None,
width: int = None, height: int = None,
x2: int = None, y2: int = None):
# -- Check for a valid combination of arguments --
- 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 reposition
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def reposition(self, # pylint: disable=too-many-arguments
win: Wnck.Window,
geom: Optional[Rectangle] = None,
monitor: Rectangle = Rectangle(0, 0, 0, 0),
keep_maximize: bool = False,
- 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 test_clip_to_usable_region
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_clip_to_usable_region(self):
"""UsableRegion: clip_to_usable_region"""
test_region = UsableRegion()
# Quick integration test for internal call to find_monitor_for
Function x_server
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def x_server(argv: List[str], screens: Dict[int, str]
) -> Generator[Dict[str, str], None, None]:
"""Context manager to launch and then clean up an X server.
:param argv: The command to launch the test X server and
- 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 test_creates_on_first_run
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def test_creates_on_first_run(self):
"""Config file is created if it doesn't exist"""
self.assertFalse(os.path.exists(self.testpath))
parsed = config.load_config(self.testpath)
self.assertTrue(os.path.exists(self.testpath))
- 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"