Amadren/lgogd_uri-mk.II

View on GitHub

Showing 15 of 15 total issues

Function analyse has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
Open

def analyse(exctyp, value, tb):
    import tokenize, keyword

    trace = StringIO()
    nlines = 3
Severity: Minor
Found in lgogd_uri/gtkexcepthook.py - About 7 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 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

Severity: Minor
Found in lgogd_uri/main.py - About 5 hrs to fix

    Function _info has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def _info(exctyp, value, tb):
        trace = None
        dialog = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_NONE)
        dialog.set_title(_("Bug Detected"))
        if gtk.check_version(2, 4, 0) is not None:
    Severity: Minor
    Found in lgogd_uri/gtkexcepthook.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 main has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def main(argv, version=DEFAULT_VERSION):
        """Install or upgrade setuptools and EasyInstall"""
        try:
            import setuptools
        except ImportError:
    Severity: Minor
    Found in ez_setup.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 lookup has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def lookup(name, frame, lcls):
        '''Find the value for a given name in the given frame'''
        if name in lcls:
            return 'local', lcls[name]
        elif name in frame.f_globals:
    Severity: Minor
    Found in lgogd_uri/gtkexcepthook.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 test_for_imports has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def test_for_imports(choices, package_name, human_package_name):
        """Detect packages without requiring egg metadata
    
        Fallback to either adding an install_requires entry or exiting with
        an error message.
    Severity: Minor
    Found in setup.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 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
    Severity: Minor
    Found in lgogd_uri/main.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 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):
    Severity: Minor
    Found in lgogd_uri/main.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

    Avoid deeply nested control flow statements.
    Open

                        if name[-1] == '.':
                            try:
                                val = getattr(prev, tstr)
                            except AttributeError:
                                # XXX skip the rest of this identifier only
    Severity: Major
    Found in lgogd_uri/gtkexcepthook.py - About 45 mins to fix

      Function use_setuptools has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def use_setuptools(
          version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
          download_delay=15
      ):
          """Automatically find/download setuptools and make it available on sys.path
      Severity: Minor
      Found in ez_setup.py - About 35 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

      Function download_setuptools has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def download_setuptools(
          version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
          delay = 15
      ):
          """Download setuptools from a specified location and return its filename
      Severity: Minor
      Found in ez_setup.py - About 35 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

      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:
      Severity: Minor
      Found in lgogd_uri/main.py - About 35 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

      Avoid too many return statements within this function.
      Open

          return None, []
      Severity: Major
      Found in lgogd_uri/gtkexcepthook.py - About 30 mins to fix

        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.
                """
        Severity: Minor
        Found in lgogd_uri/main.py - About 25 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

        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
                """
        Severity: Minor
        Found in lgogd_uri/main.py - About 25 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

        Severity
        Category
        Status
        Source
        Language