src/pyff/store.py

Summary

Maintainability
F
6 days
Test Coverage

File store.py has 590 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from six import StringIO
from copy import deepcopy
import re
from redis import Redis
from .constants import NS, ATTRS, ATTRS_INV
Severity: Major
Found in src/pyff/store.py - About 1 day to fix

    Function search has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
    Open

        def search(self, query=None, path=None, page=None, page_limit=10, entity_filter=None, related=None):
            """
    :param query: A string to search for.
    :param path: The repository collection (@Name) to search in - None for search in all collections
    :param page:  When using paged search, the page index
    Severity: Minor
    Found in src/pyff/store.py - About 1 day 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 25 (exceeds 5 allowed). Consider refactoring.
    Open

        def update(self, t, tid=None, ts=None, merge_strategy=None):  # TODO: merge ?
            #log.debug("redis store update: %s: %s" % (t, tid))
            relt = root(t)
            ne = 0
            if ts is None:
    Severity: Minor
    Found in src/pyff/store.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 _lookup has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        def _lookup(self, key):
            if key == 'entities' or key is None:
                return list(self.entities.values())
            if '+' in key:
                key = key.strip('+')
    Severity: Minor
    Found in src/pyff/store.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

    Cyclomatic complexity is too high in method _lookup. (15)
    Open

        def _lookup(self, key):
            if key == 'entities' or key is None:
                return list(self.entities.values())
            if '+' in key:
                key = key.strip('+')
    Severity: Minor
    Found in src/pyff/store.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method update. (15)
    Open

        def update(self, t, tid=None, ts=None, merge_strategy=None):  # TODO: merge ?
            #log.debug("redis store update: %s: %s" % (t, tid))
            relt = root(t)
            ne = 0
            if ts is None:
    Severity: Minor
    Found in src/pyff/store.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method search. (13)
    Open

        def search(self, query=None, path=None, page=None, page_limit=10, entity_filter=None, related=None):
            """
    :param query: A string to search for.
    :param path: The repository collection (@Name) to search in - None for search in all collections
    :param page:  When using paged search, the page index
    Severity: Minor
    Found in src/pyff/store.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method lookup. (12)
    Open

        def lookup(self, key):
            log.debug("redis store lookup: %s" % key)
            if isinstance(key, six.binary_type):
                key = key.decode("utf-8")
    
    
    Severity: Minor
    Found in src/pyff/store.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method _index_prep. (11)
    Open

        def _index_prep(self, info):
            if 'entity_attributes' in info:
                for a, v in list(info.pop('entity_attributes').items()):
                    info[a] = v
            for a, v in list(info.items()):
    Severity: Minor
    Found in src/pyff/store.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method lookup. (8)
    Open

        def lookup(self, key, raw=True, field="entity_id"):
            if key == 'entities' or key is None:
                if raw:
                    return b2u(list(self.objects.values()))
                else:
    Severity: Minor
    Found in src/pyff/store.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method update. (7)
    Open

        def update(self, t, tid=None, ts=None, merge_strategy=None):
            #log.debug("memory store update: %s: %s" % (repr(t), tid))
            relt = root(t)
            assert (relt is not None)
            ne = 0
    Severity: Minor
    Found in src/pyff/store.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method update. (6)
    Open

        def update(self, t, tid=None, ts=None, merge_strategy=None):
            relt = root(t)
            assert (relt is not None)
            ne = 0
    
    
    Severity: Minor
    Found in src/pyff/store.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method _modify. (6)
    Open

        def _modify(self, entity, modifier):
    
            def _m(idx, vv):
                getattr(idx.setdefault(vv, EntitySet()), modifier)(entity)
    
    
    Severity: Minor
    Found in src/pyff/store.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Function _index_prep has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def _index_prep(self, info):
            if 'entity_attributes' in info:
                for a, v in list(info.pop('entity_attributes').items()):
                    info[a] = v
            for a, v in list(info.items()):
    Severity: Minor
    Found in src/pyff/store.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_index has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_index(self, a, v):
            if a in DINDEX:
                return self.index[a].get(v, [])
            else:
                idx = self.index['attr'].setdefault(a, {})
    Severity: Minor
    Found in src/pyff/store.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 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def lookup(self, key):
            log.debug("redis store lookup: %s" % key)
            if isinstance(key, six.binary_type):
                key = key.decode("utf-8")
    
    
    Severity: Minor
    Found in src/pyff/store.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 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def lookup(self, key, raw=True, field="entity_id"):
            if key == 'entities' or key is None:
                if raw:
                    return b2u(list(self.objects.values()))
                else:
    Severity: Minor
    Found in src/pyff/store.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 tpart.lower().startswith(q):
                                    return tstr
                return None
    Severity: Major
    Found in src/pyff/store.py - About 45 mins to fix

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

          def update(self, t, tid=None, ts=None, merge_strategy=None):
              #log.debug("memory store update: %s: %s" % (repr(t), tid))
              relt = root(t)
              assert (relt is not None)
              ne = 0
      Severity: Minor
      Found in src/pyff/store.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 search has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def search(self, query=None, path=None, page=None, page_limit=10, entity_filter=None, related=None):
      Severity: Minor
      Found in src/pyff/store.py - About 45 mins to fix

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

            def update_entity(self, relt, t, tid, ts, p=None):
        Severity: Minor
        Found in src/pyff/store.py - About 35 mins to fix

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

              def _select(self, member=None):
                  if member is None:
                      member = "entities"
          
                  if is_text(member):
          Severity: Minor
          Found in src/pyff/store.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 [b2u(self._get_metadata(key))]
          Severity: Major
          Found in src/pyff/store.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return list(res)
            Severity: Major
            Found in src/pyff/store.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return self._lookup("{%s}%s" % (m.group(1), str(m.group(2)).rstrip("/")))
              Severity: Major
              Found in src/pyff/store.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return lst
                Severity: Major
                Found in src/pyff/store.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return []
                  Severity: Major
                  Found in src/pyff/store.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return [self.entities[key]]
                    Severity: Major
                    Found in src/pyff/store.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return b2u(self._members(key))
                      Severity: Major
                      Found in src/pyff/store.py - About 30 mins to fix

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

                            def update(self, t, tid=None, ts=None, merge_strategy=None):
                                relt = root(t)
                                assert (relt is not None)
                                ne = 0
                        
                        
                        Severity: Minor
                        Found in src/pyff/store.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 select has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def select(self, member, xp=None):
                                """
                                Select a set of metadata elements and return an EntityDescriptor with the result of the select.
                        
                                :param member: A selector (cf below)
                        Severity: Minor
                        Found in src/pyff/store.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 _modify has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def _modify(self, entity, modifier):
                        
                                def _m(idx, vv):
                                    getattr(idx.setdefault(vv, EntitySet()), modifier)(entity)
                        
                        
                        Severity: Minor
                        Found in src/pyff/store.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

                        TODO found
                        Open

                                    self.entities[relt.get('entityID')] = relt  # TODO: merge?
                        Severity: Minor
                        Found in src/pyff/store.py by fixme

                        TODO found
                        Open

                            def update(self, t, tid=None, ts=None, merge_strategy=None):  # TODO: merge ?
                        Severity: Minor
                        Found in src/pyff/store.py by fixme

                        XXX found
                        Open

                                        self.rc.expire("%s#members" % hk, 30)  # XXX bad juju - only to keep clients from hammering
                        Severity: Minor
                        Found in src/pyff/store.py by fixme

                        XXX found
                        Open

                                        self.rc.expire("%s#members" % hk, 30)  # XXX bad juju - only to keep clients from hammering
                        Severity: Minor
                        Found in src/pyff/store.py by fixme

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                                if xp is None:
                                    return l
                                else:
                                    log.debug("filtering %d entities using xpath %s" % (len(l), xp))
                                    t = entitiesdescriptor(l, 'dummy', lookup_fn=self.lookup)
                        Severity: Major
                        Found in src/pyff/store.py and 1 other location - About 6 hrs to fix
                        src/pyff/samlmd.py on lines 1117..1126

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 109.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Identical blocks of code found in 2 locations. Consider refactoring.
                        Open

                                if hasattr(l, 'tag'):
                                    l = [l]
                                elif hasattr(l, '__iter__'):
                                    l = list(l)
                        Severity: Minor
                        Found in src/pyff/store.py and 1 other location - About 45 mins to fix
                        src/pyff/samlmd.py on lines 1112..1115

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 35.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        There are no issues that match your filters.

                        Category
                        Status