emory-libraries/eulfedora

View on GitHub
eulfedora/models.py

Summary

Maintainability
F
1 wk
Test Coverage

File models.py has 1524 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# file eulfedora/models.py
#
#   Copyright 2010,2011 Emory University Libraries
#
#   Licensed under the Apache License, Version 2.0 (the "License");
Severity: Major
Found in eulfedora/models.py - About 4 days to fix

    DigitalObject has 57 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class DigitalObject(six.with_metaclass(DigitalObjectType, object)):
        """
        A single digital object in a Fedora respository, with methods and
        properties to easy creating, accessing, and updating a Fedora
        object or any of its component parts, with pre-defined datastream
    Severity: Major
    Found in eulfedora/models.py - About 1 day to fix

      Function save has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

          def save(self, logmessage=None):
              """Save datastream content and any changed datastream profile
              information to Fedora.
      
              :rtype: boolean for success
      Severity: Minor
      Found in eulfedora/models.py - About 5 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

      DatastreamObject has 36 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class DatastreamObject(object):
          """Object to ease accessing and updating a datastream belonging to a Fedora
          object.  Handles datastream content as well as datastream profile information.
          Content and datastream info are only pulled from Fedora when content and info
          fields are accessed.
      Severity: Minor
      Found in eulfedora/models.py - About 4 hrs to fix

        Cyclomatic complexity is too high in method save. (20)
        Open

            def save(self, logmessage=None):
                """Save datastream content and any changed datastream profile
                information to Fedora.
        
                :rtype: boolean for success
        Severity: Minor
        Found in eulfedora/models.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_relationship. (13)
        Open

            def modify_relationship(self, rel_uri, old_object, new_object):
                """
                Modify a relationship from RELS-EXT for this object.  As the Fedora API-M does not contain
                a native "modifyRelationship", this method purges an existing one, then adds a new one,
                pivoting on the predicate.
        Severity: Minor
        Found in eulfedora/models.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 _save_existing. (12)
        Open

            def _save_existing(self, logMessage):
                # save an object that has already been ingested into fedora
        
                # - list of datastreams that should be saved
                to_save = [ds for ds, dsobj in six.iteritems(self.dscache) if dsobj.isModified()]
        Severity: Minor
        Found in eulfedora/models.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 __new__. (12)
        Open

            def __new__(cls, name, bases, defined_attrs):
                datastreams = {}
                local_datastreams = {}
                use_attrs = defined_attrs.copy()
                reverse_rels = {}
        Severity: Minor
        Found in eulfedora/models.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 _build_foxml_datastream. (11)
        Open

            def _build_foxml_datastream(self, E, dsid, dsobj):
        
                # if we can't construct a content node then bail before constructing
                # any other nodes
                content_node = None
        Severity: Minor
        Found in eulfedora/models.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 __init__. (9)
        Open

            def __init__(self, api, pid=None, create=False, default_pidspace=None):
                self.api = api
                self.dscache = {}       # accessed by DatastreamDescriptor to store and cache datastreams
                self.relcache = {}      # used by Relation to store and cache related objects
                self._risearch = None
        Severity: Minor
        Found in eulfedora/models.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 getDatastreamObject. (8)
        Open

            def getDatastreamObject(self, dsid, dsobj_type=None, as_of_date=None):
                '''Get any datastream on this object as a :class:`DatastreamObject`
                **or** add a new datastream.  If the datastream id corresponds
                to a predefined datastream, the configured object will be returned
                and the datastream object will be returned.  If type is not
        Severity: Minor
        Found in eulfedora/models.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 __get__. (8)
        Open

            def __get__(self, obj, objtype):
                if obj is None:
                    return self
        
                #  if related object has already been cached, use the cached copy
        Severity: Minor
        Found in eulfedora/models.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 __new__ has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            def __new__(cls, name, bases, defined_attrs):
                datastreams = {}
                local_datastreams = {}
                use_attrs = defined_attrs.copy()
                reverse_rels = {}
        Severity: Minor
        Found in eulfedora/models.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

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

            def add_relationship(self, rel_uri, obj):
                """
                Add a new relationship to the RELS-EXT for this object.
                Calls :meth:`API_M.addRelationship`.
        
        
        Severity: Minor
        Found in eulfedora/models.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 purge_relationship. (7)
        Open

            def purge_relationship(self, rel_uri, obj):
                """
                Purge a relationship from RELS-EXT for this object.
                Calls :meth:`API_M.purgeRelationship`.
        
        
        Severity: Minor
        Found in eulfedora/models.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 __get__. (7)
        Open

            def __get__(self, obj, objtype):
                if obj is None:
                    return self
                # query RIsearch for subjects based on configured relation and current object
        
        
        Severity: Minor
        Found in eulfedora/models.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 class DigitalObjectType. (7)
        Open

        class DigitalObjectType(type):
            """A metaclass for :class:`DigitalObject`.
        
            All this does for now is find Datastream objects from parent classes
            and those defined on the class itself and collect them into a
        Severity: Minor
        Found in eulfedora/models.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 for_class. (6)
        Open

            @staticmethod
            def for_class(digobj, repo):
                '''Generate a ContentModel object for the specified
                :class:`DigitalObject` class.  Content model object is saved
                in the specified repository if it doesn't already exist.'''
        Severity: Minor
        Found in eulfedora/models.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 class ContentModel. (6)
        Open

        class ContentModel(DigitalObject):
            """Fedora CModel object"""
        
            CONTENT_MODELS = ['info:fedora/fedora-system:ContentModel-3.0']
            ds_composite_model = XmlDatastream('DS-COMPOSITE-MODEL',
        Severity: Minor
        Found in eulfedora/models.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 _save_existing has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            def _save_existing(self, logMessage):
                # save an object that has already been ingested into fedora
        
                # - list of datastreams that should be saved
                to_save = [ds for ds, dsobj in six.iteritems(self.dscache) if dsobj.isModified()]
        Severity: Minor
        Found in eulfedora/models.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 _build_foxml_datastream has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def _build_foxml_datastream(self, E, dsid, dsobj):
        
                # if we can't construct a content node then bail before constructing
                # any other nodes
                content_node = None
        Severity: Minor
        Found in eulfedora/models.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 modify_relationship has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def modify_relationship(self, rel_uri, old_object, new_object):
                """
                Modify a relationship from RELS-EXT for this object.  As the Fedora API-M does not contain
                a native "modifyRelationship", this method purges an existing one, then adds a new one,
                pivoting on the predicate.
        Severity: Minor
        Found in eulfedora/models.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 getDatastreamObject has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def getDatastreamObject(self, dsid, dsobj_type=None, as_of_date=None):
                '''Get any datastream on this object as a :class:`DatastreamObject`
                **or** add a new datastream.  If the datastream id corresponds
                to a predefined datastream, the configured object will be returned
                and the datastream object will be returned.  If type is not
        Severity: Minor
        Found in eulfedora/models.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 __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, obj, id, label, mimetype=None, versionable=False,
        Severity: Major
        Found in eulfedora/models.py - About 1 hr to fix

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

              def __init__(self, api, pid=None, create=False, default_pidspace=None):
                  self.api = api
                  self.dscache = {}       # accessed by DatastreamDescriptor to store and cache datastreams
                  self.relcache = {}      # used by Relation to store and cache related objects
                  self._risearch = None
          Severity: Minor
          Found in eulfedora/models.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__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def __get__(self, obj, objtype):
                  if obj is None:
                      return self
          
                  #  if related object has already been cached, use the cached copy
          Severity: Minor
          Found in eulfedora/models.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 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(self, relation, type=None, ns_prefix=None, rdf_type=None,
          Severity: Minor
          Found in eulfedora/models.py - About 45 mins to fix

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

                def __init__(self, obj, id, label, objtype=xmlmap.XmlObject, **kwargs):
            Severity: Minor
            Found in eulfedora/models.py - About 35 mins to fix

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

                  def __init__(self, pid, failure, to_be_saved, saved, cleaned):
              Severity: Minor
              Found in eulfedora/models.py - About 35 mins to fix

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

                    def add_relationship(self, rel_uri, obj):
                        """
                        Add a new relationship to the RELS-EXT for this object.
                        Calls :meth:`API_M.addRelationship`.
                
                
                Severity: Minor
                Found in eulfedora/models.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 purge_relationship has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def purge_relationship(self, rel_uri, obj):
                        """
                        Purge a relationship from RELS-EXT for this object.
                        Calls :meth:`API_M.purgeRelationship`.
                
                
                Severity: Minor
                Found in eulfedora/models.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 _build_foxml_doc has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _build_foxml_doc(self):
                        # make an lxml element builder - default namespace is foxml, display with foxml prefix
                        E = ElementMaker(namespace=self.FOXML_NS, nsmap={'foxml': self.FOXML_NS})
                        doc = E('digitalObject')
                        doc.set('VERSION', '1.1')
                Severity: Minor
                Found in eulfedora/models.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 for_class has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def for_class(digobj, repo):
                        '''Generate a ContentModel object for the specified
                        :class:`DigitalObject` class.  Content model object is saved
                        in the specified repository if it doesn't already exist.'''
                        full_name = '%s.%s' % (digobj.__module__, digobj.__name__)
                Severity: Minor
                Found in eulfedora/models.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 undo_last_save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def undo_last_save(self, logMessage=None):
                        """Undo the last change made to the datastream content and profile, effectively
                        reverting to the object state in Fedora as of the specified timestamp.
                
                        For a versioned datastream, this will purge the most recent datastream.
                Severity: Minor
                Found in eulfedora/models.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

                FIXME found
                Open

                        # FIXME: **preliminary** actual last-modified, since the above does not
                Severity: Minor
                Found in eulfedora/models.py by fixme

                FIXME found
                Open

                        # FIXME: not actually available in datastreamProfile !!
                Severity: Minor
                Found in eulfedora/models.py by fixme

                FIXME found
                Open

                        # FIXME: catch exceptions on save, treat same as failure to save (?)
                Severity: Minor
                Found in eulfedora/models.py by fixme

                TODO found
                Open

                        # TODO:
                Severity: Minor
                Found in eulfedora/models.py by fixme

                FIXME found
                Open

                        # FIXME: how to make access to a versioned ds_list ?
                Severity: Minor
                Found in eulfedora/models.py by fixme

                TODO found
                Open

                # TODO: Relation objects should probably have an intro section with a
                Severity: Minor
                Found in eulfedora/models.py by fixme

                TODO found
                Open

                        # TODO: do we need to check that subject matches self.object_type (if any)?
                Severity: Minor
                Found in eulfedora/models.py by fixme

                FIXME found
                Open

                    # FIXME: override _set_content to handle setting content?
                Severity: Minor
                Found in eulfedora/models.py by fixme

                FIXME found
                Open

                            # FIXME: should we default to the datastreams defined in code?
                Severity: Minor
                Found in eulfedora/models.py by fixme

                TODO found
                Open

                # Relation  (list variant still TODO)
                Severity: Minor
                Found in eulfedora/models.py by fixme

                FIXME found
                Open

                    # FIXME: override _set_content to handle setting full xml content?
                Severity: Minor
                Found in eulfedora/models.py by fixme

                FIXME found
                Open

                            # FIXME: can we take advantage of Datastream descriptor? or at least use dscache ?
                Severity: Minor
                Found in eulfedora/models.py by fixme

                TODO found
                Open

                            # TODO: look into handling this the way django handles
                Severity: Minor
                Found in eulfedora/models.py by fixme

                FIXME found
                Open

                            # FIXME: should be able to handle checksums
                Severity: Minor
                Found in eulfedora/models.py by fixme

                XXX found
                Open

                        # XXX: should this use _defined_datastreams instead?
                Severity: Minor
                Found in eulfedora/models.py by fixme

                TODO found
                Open

                        # TODO: Once we have an eulfedora.api call that returns
                Severity: Minor
                Found in eulfedora/models.py by fixme

                FIXME found
                Open

                            # FIXME: probably need a better way to check this.
                Severity: Minor
                Found in eulfedora/models.py by fixme

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

                    def purge_relationship(self, rel_uri, obj):
                        """
                        Purge a relationship from RELS-EXT for this object.
                        Calls :meth:`API_M.purgeRelationship`.
                
                
                Severity: Major
                Found in eulfedora/models.py and 1 other location - About 1 day to fix
                eulfedora/models.py on lines 1891..1925

                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 142.

                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

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

                    def add_relationship(self, rel_uri, obj):
                        """
                        Add a new relationship to the RELS-EXT for this object.
                        Calls :meth:`API_M.addRelationship`.
                
                
                Severity: Major
                Found in eulfedora/models.py and 1 other location - About 1 day to fix
                eulfedora/models.py on lines 1927..1961

                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 142.

                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

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

                        for dsname, ds in self._adhoc_datastreams.items():
                            dsobj = getattr(self, dsname)
                            dsnode = self._build_foxml_datastream(E, ds.id, dsobj)
                            if dsnode is not None:
                                doc.append(dsnode)
                Severity: Major
                Found in eulfedora/models.py and 1 other location - About 2 hrs to fix
                eulfedora/models.py on lines 1643..1647

                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 59.

                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

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

                        for dsname, ds in self._defined_datastreams.items():
                            dsobj = getattr(self, dsname)
                            dsnode = self._build_foxml_datastream(E, ds.id, dsobj)
                            if dsnode is not None:
                                doc.append(dsnode)
                Severity: Major
                Found in eulfedora/models.py and 1 other location - About 2 hrs to fix
                eulfedora/models.py on lines 1650..1654

                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 59.

                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

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

                        if self.label:
                            label = E('property')
                            label.set('NAME', 'info:fedora/fedora-system:def/model#label')
                            label.set('VALUE', self.label)
                            props.append(label)
                Severity: Major
                Found in eulfedora/models.py and 1 other location - About 1 hr to fix
                eulfedora/models.py on lines 1671..1675

                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 46.

                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

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

                        if self.owner:
                            owner = E('property')
                            owner.set('NAME', 'info:fedora/fedora-system:def/model#ownerId')
                            owner.set('VALUE', self.owner)
                            props.append(owner)
                Severity: Major
                Found in eulfedora/models.py and 1 other location - About 1 hr to fix
                eulfedora/models.py on lines 1665..1669

                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 46.

                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

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                        for s, p, o in object_triples:
                            self.content.remove((s, p, src))
                            self.content.add((s, p, dest))
                Severity: Major
                Found in eulfedora/models.py and 2 other locations - About 1 hr to fix
                eulfedora/models.py on lines 642..644
                eulfedora/models.py on lines 647..649

                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 40.

                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

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                        for s, p, o in subject_triples:
                            self.content.remove((src, p, o))
                            self.content.add((dest, p, o))
                Severity: Major
                Found in eulfedora/models.py and 2 other locations - About 1 hr to fix
                eulfedora/models.py on lines 647..649
                eulfedora/models.py on lines 652..654

                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 40.

                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

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                        for s, p, o in predicate_triples:
                            self.content.remove((s, src, o))
                            self.content.add((s, dest, o))
                Severity: Major
                Found in eulfedora/models.py and 2 other locations - About 1 hr to fix
                eulfedora/models.py on lines 642..644
                eulfedora/models.py on lines 652..654

                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 40.

                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

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

                    @property
                    def methods(self):
                        if self._methods is None:
                            self.get_methods()
                        return self._methods
                Severity: Minor
                Found in eulfedora/models.py and 1 other location - About 30 mins to fix
                eulfedora/models.py on lines 1402..1406

                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 32.

                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

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

                    @property
                    def history(self):
                        if self._history is None:
                            self.getHistory()
                        return self._history
                Severity: Minor
                Found in eulfedora/models.py and 1 other location - About 30 mins to fix
                eulfedora/models.py on lines 1798..1802

                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 32.

                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