emory-libraries/eulexistdb

View on GitHub

Showing 37 of 58 total issues

Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self, model=None, xpath=None, using=None, collection=None,
Severity: Minor
Found in eulexistdb/query.py - About 45 mins to fix

    Function _return_field_xpath has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def _return_field_xpath(self, xpath):
            if isinstance(xpath, ast.Step):
                # FIXME: should predicates be removed here?
                # field[x] should be sufficient to identify return node, and predicates may not match
                return "field[%d]/%s" % (self._return_field_count, serialize(xpath))
    Severity: Minor
    Found in eulexistdb/query.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

    Consider simplifying this complex logical expression.
    Open

            if self.order_by or self.return_fields or self.additional_return_fields \
               or self.where_filters or (self.ft_query and self.fulltext_options):
    
                # some let statements must come at the beginning of a FLOWR query
                if self.ft_query and self.fulltext_options:
    Severity: Major
    Found in eulexistdb/query.py - About 40 mins to fix

      Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, timeout=ExistDB.DEFAULT_TIMEOUT, session=None,
      Severity: Minor
      Found in eulexistdb/db.py - About 35 mins to fix

        Function _wrap has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def _wrap(begin, text, parts, end, tail):
        Severity: Minor
        Found in eulexistdb/templatetags/existdb.py - About 35 mins to fix

          Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(self, xpath=None, collection=None, document=None,
          Severity: Minor
          Found in eulexistdb/query.py - About 35 mins to fix

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

                def __init__(self, model=None, xpath=None, using=None, collection=None,
                            xquery=None, fulltext_options=None):
                    self.model = model
                    self._db = using
                    if fulltext_options is None:
            Severity: Minor
            Found in eulexistdb/query.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 'node'      # generic node name should work for most cases
            Severity: Major
            Found in eulexistdb/query.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return None     # FIXME: is there any sane fall-back return?
              Severity: Major
              Found in eulexistdb/query.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return self._return_field_xpath(xpath.relative)
                Severity: Major
                Found in eulexistdb/query.py - About 30 mins to fix

                  Function get_return_xpaths has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def get_return_xpaths(self):
                          """Generate a dictionary of xpaths to match the results as they will be
                          returned in a constructed return result (when return fields have
                          been specified by :meth:`return_also` or :meth:`return_only`).
                  
                  
                  Severity: Minor
                  Found in eulexistdb/query.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 message has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def message(self):
                          "Rough conversion of xmlrpc fault string into something human-readable."
                          try:
                              orig_except = self.args[0]
                          except IndexError:
                  Severity: Minor
                  Found in eulexistdb/exceptions.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 _raw_field has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _raw_field(self, only=False, also=False, **fields):
                          'Common functionality for :meth:`also_raw` and :meth:`only_raw`.'
                          field_objs = {}
                          field_xpath = {}
                          for field, xpath in fields.iteritems():
                  Severity: Minor
                  Found in eulexistdb/query.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 request_patching has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def request_patching(patches):
                      """
                      Request that patches be applied. This effectively adds to the set
                      of patches that are requested.
                  
                  
                  Severity: Minor
                  Found in eulexistdb/patch.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 hasCollection has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def hasCollection(self, collection_name):
                          """Check if a collection exists.
                  
                          :param collection_name: string name of collection
                          :rtype: boolean
                  Severity: Minor
                  Found in eulexistdb/db.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 _runQuery has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _runQuery(self, start=None, max_items=None):
                          """Execute the currently configured query."""
                          if max_items is None:
                              max_items = self.default_chunk_size
                          # exist start begins at 1, not 0
                  Severity: Minor
                  Found in eulexistdb/query.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 _return_name_from_xpath has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _return_name_from_xpath(self, parsed_xpath):
                          "Generate a top-level return element name based on the xpath."
                          if isinstance(parsed_xpath, ast.Step):
                              # if this is a step, just use the node test
                              # special cases: node tests that can't be used as return element
                  Severity: Minor
                  Found in eulexistdb/query.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