emory-libraries/eulfedora

View on GitHub

Showing 75 of 182 total issues

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 estimate_object_size has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def estimate_object_size(obj, archive=True):
        '''Calculate a rough estimate of object size, based on the sizes of
        all versions of all datastreams.  If archive is true, adjusts
        the size estimate of managed datastreams for base64 encoded data.
        '''
    Severity: Minor
    Found in eulfedora/syncutil.py - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

        def get_object(self, pid=None, type=None, create=None):
            """
            Initialize a single object from Fedora, or create a new one, with the
            same Fedora configuration and credentials.
    
    
    Severity: Minor
    Found in eulfedora/server.py - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

        def get_datastream_info(self, dsinfo):
            '''Use regular expressions to pull datastream [version]
            details (id, mimetype, size, and checksum) for binary content,
            in order to sanity check the decoded data.
    
    
    Severity: Minor
    Found in eulfedora/syncutil.py - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

        def findObjects(self, query=None, terms=None, pid=True, chunksize=None, session_token=None):
            """
            Wrapper function for `Fedora REST API findObjects <http://fedora-commons.org/confluence/display/FCR30/REST+API#RESTAPI-findObjects>`_
            and `Fedora REST API resumeFindObjects <http://fedora-commons.org/confluence/display/FCR30/REST+API#RESTAPI-resumeFindObjects>`_
    
    
    Severity: Minor
    Found in eulfedora/api.py - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

    def index_config(request):
        '''This view returns the index configuration of the current
        application as JSON.  Currently, this consists of a Solr index url
        and the Fedora content models that this application expects to index.
    
    
    Severity: Minor
    Found in eulfedora/indexdata/views.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 s.encode(encoding)
    Severity: Major
    Found in eulfedora/util.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                      return self.fedora_failed.render(context)
      Severity: Major
      Found in eulfedora/templatetags/fedora.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                        return ''
        Severity: Major
        Found in eulfedora/templatetags/fedora.py - About 30 mins to fix

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

          def index_data(request, id, repo=None):
              '''Return the fields and values to be indexed for a single object
              as JSON.  Index content is generated via
              :meth:`eulfedora.models.DigitalObject.index_data`.
          
          
          Severity: Minor
          Found in eulfedora/indexdata/views.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 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

          Severity
          Category
          Status
          Source
          Language