File main.py
has 382 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""Wrapper for lgogdownloader to support queueing up gogdownloader:// URIs
Copyright (C) 2015 Stephan Sokolow
Function next_download
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def next_download(self):
"""Common code for the Save button and lgogdownloader exit handler"""
queue_iter = self.data.get_iter_first()
if not queue_iter:
# Do this as early as possible to minimize the chance that
- 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_lgogd_conf
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get_lgogd_conf():
"""Read and parse lgogdownloader's config file."""
results = {}
path = os.path.expanduser(LGOGD_CFG_PATH)
if not os.path.exists(path):
- 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 _init_gui
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _init_gui(self):
"""Parts of __init__ that should only run in the single instance."""
# Check for some deps late enough to display a GUI error message
dep_err = self._check_deps()
if dep_err:
- 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 gtkbuilder_load
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def gtkbuilder_load(self, path):
"""Wrapper to work around the brokenness of
GtkCellRendererToggle.set_active() and the inability to retrieve
attributes from columns once set.
"""
- 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 on_view_dlqueue_button_press_event
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def on_view_dlqueue_button_press_event(self, widget, event=None):
"""Right-click and Menu button handler for the TreeView.
Source: http://faq.pygtk.org/index.py?req=show&file=faq13.017.htp
"""
- 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"