crawley-project/crawley

View on GitHub

Showing 16 of 50 total issues

File browser.py has 383 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import multiprocessing

from lxml import etree
from PyQt4 import QtCore, QtWebKit, QtGui
from baseBrowser import BaseBrowser, BaseBrowserTab, FrmBaseConfig, FrmBaseSettings
Severity: Minor
Found in crawley/web_browser/browser.py - About 5 hrs to fix

    Function setupUi has 88 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def setupUi(self, Settings):
            Settings.setObjectName("Settings")
            Settings.resize(340, 476)
            self.groupBox = QtGui.QGroupBox(Settings)
            self.groupBox.setGeometry(QtCore.QRect(10, 10, 541, 241))
    Severity: Major
    Found in crawley/web_browser/GUI/settings.py - About 3 hrs to fix

      Function setupUi has 76 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def setupUi(self, MainWindow):
              MainWindow.setObjectName("MainWindow")
              MainWindow.resize(1132, 671)
              self.centralwidget = QtGui.QWidget(MainWindow)
              font = QtGui.QFont()
      Severity: Major
      Found in crawley/web_browser/GUI/base.py - About 3 hrs to fix

        OrderedDict has 25 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class OrderedDict(dict):
            'Dictionary that remembers insertion order'
            # An inherited dict maps keys to values.
            # The inherited dict provides __getitem__, __len__, __contains__, and get.
            # The remaining methods are order-aware.
        Severity: Minor
        Found in crawley/utils/collections/ordered_dict.py - About 2 hrs to fix

          BrowserTab has 24 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class BrowserTab(BaseBrowserTab):
              """
                  A Browser Tab representation
          
                  This class overrides all the methods of the
          Severity: Minor
          Found in crawley/web_browser/browser.py - About 2 hrs to fix

            Function _gen_scrape_method has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                def _gen_scrape_method(self, sentences):
                    """
                        Generates scrapers methods.
                        Returns a dictionary containing methods and attributes for the
                        scraper class.
            Severity: Minor
            Found in crawley/simple_parser/compilers.py - About 2 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 update has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                def update(*args, **kwds):
                    '''od.update(E, **F) -> None.  Update od from dict/iterable E and F.
            
                    If E is a dict instance, does:           for k in E: od[k] = E[k]
                    If E has a .keys() method, does:         for k in E.keys(): od[k] = E[k]
            Severity: Minor
            Found in crawley/utils/collections/ordered_dict.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 _fetch has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def _fetch(self, url, depth_level=0):
                    """
                        Recursive url fetching.
            
                        Params:
            Severity: Minor
            Found in crawley/crawlers/base.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 _dump_file has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def _dump_file(self, settings_dict):
                    """
                        Writes the settings_dict to a settings.py file
                    """
                    SEPARATOR = " = "
            Severity: Minor
            Found in crawley/web_browser/browser.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 setupUi has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def setupUi(self, FrmConfig):
                    FrmConfig.setObjectName("FrmConfig")
                    FrmConfig.resize(400, 131)
                    self.bt_ok = QtGui.QPushButton(FrmConfig)
                    self.bt_ok.setGeometry(QtCore.QRect(310, 100, 81, 27))
            Severity: Minor
            Found in crawley/web_browser/GUI/config.py - About 1 hr to fix

              Function parse has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def parse(self):
              
                      blocks = []
                      lines = []
              
              
              Severity: Minor
              Found in crawley/simple_parser/parsers.py - About 55 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 gen_entities has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def gen_entities(self):
                      """
                          Generates the entities classes
                      """
              
              
              Severity: Minor
              Found in crawley/simple_parser/compilers.py - About 45 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__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(self, host, port=25, user=None, password=None, enable_ssl=True):
              Severity: Minor
              Found in crawley/smtp/sender.py - About 35 mins to fix

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

                    def __init__(self, parent, settings):
                        """
                            Setups the frm settings window
                        """
                
                
                Severity: Minor
                Found in crawley/web_browser/browser.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 _validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _validate(self, response):
                        """
                            Override this method in order to provide more validations before the data extraction with the given scraper class
                        """
                
                
                Severity: Minor
                Found in crawley/scrapers/base.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 get_response has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get_response(self, request, data):
                        """
                            Tries [MAX_TRIES] times to get the response and
                            return the response data
                        """
                Severity: Minor
                Found in crawley/http/managers.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